[Javascript] Show/Hide advanced form and submitting

Bill Moseley moseley at hank.org
Mon Feb 5 18:58:48 CST 2007


I have a simple task to show/hide an advanced search form.
With javascript turned off the full (advanced) form shows, which is
fine.

With javascript enabled, the advanced part of the form is hidden, and
<span> nodes are are created to show/hide the form.

Now, even with the form hidden (.style.display = 'none') the hidden
fields are submitted.  Are there any simple tricks to only submit the
fields that are not hidden?

I'm currently using a hidden field that I also toggle that will tell
my program if the advanced form was displayed or not.  But, it would
be nice if the request didn't include all the form parameters when
just using the simple form.


I suppose the other option is to have two separate forms, but that
looks odd when javascript is disabled.





-- 
Bill Moseley
moseley at hank.org




More information about the Javascript mailing list