[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Hidden field not persisting across reload

Never paid much attention to hidden fields, but I thought they were supposed
to retain their value across a reload/resize?  Maybe not...

I've cut down a page I was working on to the bare essentials.
Simply cut & paste this into a new HTML file.

1- 'SAVE' the value in the text field to the hidden field.
2- 'CHECK' the hidden field value (it should be fine).
3- reload/resize the page
4- the hidden field got wiped out.

I'm a little dizzy right now, I always took for granted that hidden fields
persisted.  What have I missed??

<SCRIPT LANGUAGE="Javascript">
function save() {
 document.persistent.data.value = "" +  document.persistent.input.value

function check() {
 alert('document.persistent.data.value =  ' +document.persistent.data.value)

function load() {
 document.persistent.input.value =  document.persistent.data.value

// -->
<BODY onLoad="check()">

<FORM NAME="persistent">
  <INPUT TYPE="hidden" NAME="data">
  <INPUT NAME="input" VALUE="default">
<BR>  <INPUT TYPE="button" VALUE="Save to hidden field" onClick="save()">
<BR>  <INPUT TYPE="button" VALUE="Load to text field" onClick="load()">
<BR>  <INPUT TYPE="button" VALUE="Check hidden field" onClick="check()">

-Andy Augustine

For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/