how to see if an element is shown or hidden & set a field when submitting
i've got the following:
people can either pick an item from a drop down list, or open a table and fill out some fields. Whatever they've done, it is written away to a cookie.
What I would like extra and which I can't get to work is that when the submit button is hit, a form field gets a value as to whether the table was opened or not at the time of submitting.
You see, I would actually like the form fields in the table to stay populated with the input they once have given (if at all) but if the table was not opened when submitted, then one form field should say so (so I know to just look at the drop down value).
The code to hide/show the table is this:
and it sets the 'geheim' form field, but only if the state (show/hide) has been changed.
if (document.getElementById(text).style.display == 'none')
document.getElementById(text).style.display = 'block';
document.getElementById(text).style.display = 'none';
Thing is, the geheim form field is default on "plaats", but it will somehow change to "coordinaten" when one hits submit if that has been selected once. But only if the table state (show hide) has not been change this time.
You can see it in action here: