Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you need to refresh the page and keep the form data without resubmitting the POST, you may be able (depending of the size and complexity of your form data) to build a representation of the form state in JavaScript, store it in a cookie or the querystring, refresh the page by setting document.location.href, and then reload the data when the window loads. </p> <p>Below is a rough version of this idea. This code along, with an onload wire-up, would go in the opener (the cookie handling methods would also need added). window.opener.refreshWithState() would be called from the popup.</p> <p>(this version depends on inputs having unique IDs)</p> <pre><code>(function() { window.refreshWithState = function() { setCookie("state", buildState()); document.location.href = document.location.href; }; function handleWindowLoad() { var state = readCookie("state"); if (state) { restoreState(state); eraseCookie("state"); } } function buildState() { var i, elem, elems, key, val, stateParts = []; elems = document.getElementsByTagName('INPUT'); for (i = 0; elem = elems[i]; i++) { switch (elem.type) { case "checkbox": case "radio": val = elem.checked ? 1 : ""; break; case "text": case "hidden": case "file": val = escape(elem.value); break; default: continue; } stateParts.push('"' + escape(elem.id) + '":"' + val + '"'); } elems = document.getElementsByTagName('SELECT'); for (i = 0; elem = elems[i]; i++) { stateParts.push('"' + escape(elem.id) + '":"' + elem.selectedIndex + '"'); } return '{' + stateParts.join(',') + '}'; } function restoreState(state) { var key, elem, val; var stateObj = eval('(' + state + ')'); for (key in stateObj) { elem = document.getElementById(unescape(key)); if (!elem) { continue; } val = stateObj[key]; if (elem.tagName == "SELECT") { elem.selectedIndex = val; } else if (elem.tagName == "INPUT") { switch (elem.type) { case "checkbox": case "radio": elem.checked = !!val; break; case "text": case "hidden": case "file": elem.value = unescape(val); } } } } })(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload