If jQuery's toggle()
is used on a <div>
containing form elements, will those form elements get submitted with the form, even though they are hidden?
My code (though probably not needed for this particular question):
$('.cms_loop_title').click(function(){ $ctg = $(this).attr('rel'); $('.'+$ctg).toggle(); //alert($ctg); });
Even though the hidden input cannot be seen at all, its data is still submitted.
Definition and Usage. The <input type="hidden"> defines a hidden input field. A hidden field lets web developers include data that cannot be seen or modified by users when a form is submitted. A hidden field often stores what database record that needs to be updated when the form is submitted.
Since they are not rendered visible, hidden inputs are sometimes erroneously perceived as safe. But similar to session cookies, hidden form inputs store the software's state information client-side, instead of server-side. This makes it vulnerable.
To hide an element, set the style display property to “none”. document. getElementById("element").
Yes, they'll get submitted unless they are removed from the document or have the disabled
attribute set on them.
For more information, see the HTML5 Working Draft — Section 4.10.22.4 Constructing the form data set. The information there is more-or-less the same as previous HTML versions.
In order to prevent submitting, you have to disable the elements. Hiding doesn't do the trick (I had the same issue a while ago)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With