Results 1 to 4 of 4

Thread: input in a text box still appear after page refresh for IE but not FF, Chrome, Opera

  1. #1
    Join Date
    Feb 2010

    input in a text box still appear after page refresh for IE but not FF, Chrome, Opera

    I want to keep the value of the user input (e.g. text box value) displayed after page refresh by a javascript.
    The following test web page is used.
    The alerts appear before and after the page refresh as expected on all browsers (FF, Chrome, Opera & IE).
    The input value in a text box still appear after page refresh for IE but not FF, Chrome, Opera.
    Please help to make it work for FF, Chrome, Opera.
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <link rel="stylesheet" type="text/css" media="all" href="css/style.css" />
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
             Rows Per Page
             <input type="text" name="rowsPerPage" id="rowsPerPage" />
             <input type="submit" value="savevalue" onClick="savevalue()">
          <script type="text/javascript" src="js/prototype.js"></script>
          <script type="text/javascript" src="js/Cookie.js"></script>
          <script type="text/javascript">
             Cookie.init({name: 'mydata'});
             function savevalue() {
                var rowsPerPageElem = document.getElementById("rowsPerPage");
                alert('rowsPerPageElem.value ' + rowsPerPageElem.value);
                Cookie.setData('rowsPerPage', rowsPerPageElem.value);
                var rowsPerPage = Cookie.getData('rowsPerPage');
                alert(' rowsPerPage ' + rowsPerPage);
                var rowsPerPageElem = document.getElementById("rowsPerPage");
                rowsPerPageElem.value = rowsPerPage;

  2. #2
    Join Date
    Feb 2003
    Michigan, USA
    Persisting form field values after a refresh is not a standardized behavior for browsers. There's nothing wrong with the form fields being blanked out after a refresh, and there's nothing wrong with the form field values persisting either.

    What you see with every browser is normal behavior for that browser.

  3. #3
    Join Date
    Mar 2010
    I can't test your code because I don't have Cookie.js and prototype.js

    Maybe your problem is inside one of those files.

  4. #4
    Join Date
    Aug 2010



    You may have to give the value attribute as given below. ${param.<name of the input box>}.

    <input type="text" readonly="true" name="startDatetxt" value="${param.startDatetxt}" />

    Raga R

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center