I have a form that let's users enter information. If the user has no posting privileges, a dialog comes up and there I explain why they cannot post, and there is a redirect to the page where they can buy. It is kind of rough because it briefly displays the
form, and then shows the buy page
Unfortunately when you hit back, after the redirect, it then displays the form.
Hello, I apologize to you for my inadequate description. From your description, You mean that you do something in page A then redirect to page B, after that you hit BACK then page A displays
with values you put last time. Your question is how to clean up this values. If I am right, you can use my code in your page A. when you hit BACK and page A displays your browser will not send request to the server, it just get info from Browser Caching, so
the info you put last time is also there, however the onload event works every time, so you could clean up info in this event. If I am wrong, would you please give me more detail info and I will follow this issue in the future.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
page A contains code to collect data and display a form as well as some code to determine if the form should be displayed. if the form is not displayed the user sees a dialog (jQuery) which says you are not allowed to enter this form. after the user clicks
ok, the form shows and then the redirect goes to page B. I would prefer that the form is not shown at all, but I can live with that for now. from Page B when the user hits back, it now shows the form. how can I prevent the form from showing briefly and how
can I prevent that no matter what that form gets shown on back?
Click on "Mark as Answer" if my answers help you along.
Thanks for your sharing, Now I see what you want. I reappeared the situation you post local. Below is my code:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" >
<script src="Scripts/jquery-1.7.1.js"></script>
<script type="text/javascript">
function test() // for this function you can find that the textbox showing briefly then redirect to page "Default.aspx"
{
location.href = "Default.aspx"; // this will work at the end of this function
$("#names").show();
}
</script>
<div>
name: <input type="text" value="" name="1" id="names" style="display:none;" />
</div>
</form>
<input type="button" name="ss" value="d3d" id="Button1" onclick="test();" />
</body>
</html>
Because I don’t have your javascript code, If you still have any questions, it is wonderful that post your javascript
code and I can give insufficient help. Thank you.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
I have been able to resolve my problem by wrapping the form in an extra if-statement.
If the condition is met the form does not get displayed, but the redirect still takes place.
When the user clicks BACK, after the redirect, it displays a page with links to the various other pages, but not the form.
Not as clean as I would have liked but, much better than what I had before.
Is is possible to delete the last entry from the list of pages the browser keeps?
For instance suppose the browser history is:
page F
page E
page A (my page from the code below)
page B (the redirect page).
How does one delete page A from the history, so that when BACK is selected the browser takes the user to page E?
Here is the concept of my code so far:
@{
// code here to collect data for form purpose
// code here to determine status go or nogo
if(IsPost)
{
code here to read form data and store in db
}
}
@if (status == "no go") //this displays the dialog with the warning
{
<div id="dialog-message1" title="Warning: account balances">
<p><span class="ui-icon ui-icon-circle-check" style="float: left; margin: 0 7px 50px 0;"></span>@modal</p>
<br/>
<p> No Balance:</p>
<br/>
</div>
}
@if (balancestatus != "no go")
{
<form method="post">
// the rest of the form here
</form>
}
<script> // jQuery for the dialog
$("#dialog-message1").dialog({
modal: true,
buttons: {
Ok: function () {
$(this).dialog("close");
window.location.href="/Buy.cshtml"
}
}
});
</script>
Click on "Mark as Answer" if my answers help you along.
Hello, About your question I’ll give you my suggestion.
Is it possible to delete the last entry from the list of pages the browser keeps?
If you want to clean up the values whenever the page loads, just clean in event “onload”. We can also do this depends on some check such as is there any parameters in url. Below is a demo:
Contributor
2591 Points
2665 Posts
cleaning up what happens if user hits BACK after redirect
Jul 22, 2013 11:45 AM|wavemaster|LINK
I have a form that let's users enter information. If the user has no posting privileges, a dialog comes up and there I explain why they cannot post, and there is a redirect to the page where they can buy. It is kind of rough because it briefly displays the form, and then shows the buy page
Unfortunately when you hit back, after the redirect, it then displays the form.
Here is the dialog code:
As an improvement I wrapped the entire form in an if statement
Now when you select BACK after the redirect has completed is displays:
What is the proper way to clean this up?
TIA
Robert
Member
215 Points
29 Posts
Re: cleaning up what happens if user hits BACK after redirect
Jul 23, 2013 04:21 AM|Javen Yao - MSFT|LINK
Hello,
Thanks for posting.
From your description, you want to clear up the values when hit back. I think you can clean the values in function “load()”.
Here is parts of code:
please try it, hope it can help you. Thank you.
Feedback to us
Contributor
2591 Points
2665 Posts
Re: cleaning up what happens if user hits BACK after redirect
Jul 23, 2013 08:54 AM|wavemaster|LINK
I have absolutely no idea what this is supposed to do, let alone where to implement it in my code.
Member
215 Points
29 Posts
Re: cleaning up what happens if user hits BACK after redirect
Jul 23, 2013 11:14 PM|Javen Yao - MSFT|LINK
Hello, I apologize to you for my inadequate description. From your description, You mean that you do something in page A then redirect to page B, after that you hit BACK then page A displays with values you put last time. Your question is how to clean up this values. If I am right, you can use my code in your page A. when you hit BACK and page A displays your browser will not send request to the server, it just get info from Browser Caching, so the info you put last time is also there, however the onload event works every time, so you could clean up info in this event. If I am wrong, would you please give me more detail info and I will follow this issue in the future.
Feedback to us
Contributor
2591 Points
2665 Posts
Re: cleaning up what happens if user hits BACK after redirect
Jul 23, 2013 11:36 PM|wavemaster|LINK
Contributor
4010 Points
1926 Posts
Re: cleaning up what happens if user hits BACK after redirect
Jul 24, 2013 02:44 AM|Afzaal.Ahmad.Zeeshan|LINK
Hi, what happens when you use
So everytime the page loads, it gets the value "". Does this work for you?
Member
215 Points
29 Posts
Re: cleaning up what happens if user hits BACK after redirect
Jul 24, 2013 03:11 AM|Javen Yao - MSFT|LINK
Thanks for your sharing, Now I see what you want. I reappeared the situation you post local. Below is my code:
Because I don’t have your javascript code, If you still have any questions, it is wonderful that post your javascript code and I can give insufficient help. Thank you.
Feedback to us
Contributor
2591 Points
2665 Posts
Re: cleaning up what happens if user hits BACK after redirect
Jul 24, 2013 05:14 AM|wavemaster|LINK
I have been able to resolve my problem by wrapping the form in an extra if-statement.
If the condition is met the form does not get displayed, but the redirect still takes place.
When the user clicks BACK, after the redirect, it displays a page with links to the various other pages, but not the form.
Not as clean as I would have liked but, much better than what I had before.
Is is possible to delete the last entry from the list of pages the browser keeps?
For instance suppose the browser history is:
page F
page E
page A (my page from the code below)
page B (the redirect page).
How does one delete page A from the history, so that when BACK is selected the browser takes the user to page E?
Here is the concept of my code so far:
Member
215 Points
29 Posts
Re: cleaning up what happens if user hits BACK after redirect
Jul 24, 2013 10:03 PM|Javen Yao - MSFT|LINK
Hello, About your question I’ll give you my suggestion.
If you want to clean up the values whenever the page loads, just clean in event “onload”. We can also do this depends on some check such as is there any parameters in url. Below is a demo:
From this demo we can view this page by “http://..../WebForm1.aspx” or “http://..../WebForm1.aspx?xx=0”. Then we can find the difference.
About this question I don’t suggest you to do this. Because you want to delete the client file by your code, it is always not allowed.
Thank you!
Feedback to us