Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Page cannot be refreshed without resending the information Javascript.

Posted on 2009-04-23
6
Medium Priority
?
465 Views
Last Modified: 2012-05-06
Please see the below code.
On page load, I am having three dropdowns for month, week and year.
Then depending upon the selection and button submit will change the values for <div id="datesdiv> and <div id="data">.

1. Problem is if I use form post method , after form submit, if I refresh the page, alert message will apeear saying "page cannot be refreshed without resending the information.

2. Problem2: If I use Get Method, alert will be gone, but in the case form values are passing in the url: I dont want that url will have any variables passed.
Ex:http://test.htm?date1=04%2F20%2F09&date2=04%2F26%2F09&year=2009&month=4&day=20

Please make changes in the code so that either of the methods will work.

Thanks
<form id="Frm" onSubmit="report(this,true);" method="post">
<input type="hidden" id="refreshed" value="no">
<input type="hidden" id="date1" name="date1" />
<input type="hidden" id="date2" name="date2" />
	
<select name="month" id="month" onChange="setDate(this.form)">
<option value="1">January
<option value="2">February
<option value="3">March
<option value="4">April
<option value="5">May
<option value="6">June
<option value="7">July
<option value="8">August
<option value="9">September
<option value="10">October
<option value="11">November
<option value="12">December
</select>
<select name="week" style="width:180px;">
<option value="1">week of April6
<option value="2">week of april20
<option value="3">week of april27
</select>
<select name="year" onChange="setDate(this.form)">
</select>
<input type="submit" value="Get Bulletins" />
</form>
<div id="datesDiv" style="display:none;"></div>
<div id="data">
Url1: Google
Ur2:MSn
</div>

Open in new window

0
Comment
Question by:Saroj13
  • 4
  • 2
6 Comments
 
LVL 21

Accepted Solution

by:
silemone earned 1500 total points
ID: 24219685


here is another suggestion:

Here are some suggestions from the Experts Exchange web site, but
as you don't want to change anything with the JavaScript or the form
code, it isn't going to do you any good.  Trying to find a fix on the
browser side is not going to be the solution, and as I already stated,
there are several things (POST v GET, various frame and JavaScript
conditions) that can cause this problem, all of which requires changes
to one part of the page code or another.

Some snippets follow:

"...
<%@ Language="VBScript" %>
<% Response.Expires= -1
Response.AddHeader "Cache-Control", "no-cache"
Response.AddHeader "Pragma", "no-cache" %>
<%
..."

"You should put the Response.clear at the bottom of the page ..."

"Does a <body onLoad="init()">  script help?
In that function init() you can clear the fields or set them to
default state."

"...
<%Response.CacheControl="Public"%> did the trick.

It didn't work at first but when I removed
Response.AddHeader "Cache-Control", "no-cache"
... it worked just as
0
 

Author Comment

by:Saroj13
ID: 24219755
Thanks SILMONE> But how this can be done in javascript, html
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 21

Expert Comment

by:silemone
ID: 24219924
well i suppose since this is all javascript, you could add a reset method to your page

i.e. "Does a <body onLoad="init()">  script help?

and create an init method that clears all values


0
 

Author Comment

by:Saroj13
ID: 24219965
init() gives the javascript error
0
 
LVL 21

Expert Comment

by:silemone
ID: 24219974
what did you put inside of init()?


Init is a javascript method you have to implement.


function init()
{
         //make all controls value = '' or null
}
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question