Page cannot be refreshed without resending the information Javascript.

Posted on 2009-04-23
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.

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

<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 name="week" style="width:180px;">

<option value="1">week of April6

<option value="2">week of april20

<option value="3">week of april27


<select name="year" onChange="setDate(this.form)">


<input type="submit" value="Get Bulletins" />


<div id="datesDiv" style="display:none;"></div>

<div id="data">

Url1: Google



Open in new window

Question by:Saroj13
    LVL 21

    Expert Comment

    LVL 21

    Accepted Solution


    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

    Author Comment

    Thanks SILMONE> But how this can be done in javascript, html
    LVL 21

    Expert Comment

    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


    Author Comment

    init() gives the javascript error
    LVL 21

    Expert Comment

    what did you put inside of init()?

    Init is a javascript method you have to implement.

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
    In Part 1 ( we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
    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…

    758 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

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now