Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You could do this (using jQuery as an example) by using the :visible selector to see which form elements are visible, and then either serializing the visible ones into a form and submitting it, or removing the invisible ones.</p> <p><a href="http://docs.jquery.com/Selectors/visible" rel="nofollow noreferrer">http://docs.jquery.com/Selectors/visible</a> <a href="http://docs.jquery.com/Selectors" rel="nofollow noreferrer">http://docs.jquery.com/Selectors</a></p> <p><a href="http://docs.jquery.com/Ajax/serialize" rel="nofollow noreferrer">http://docs.jquery.com/Ajax/serialize</a> <a href="http://docs.jquery.com/Ajax" rel="nofollow noreferrer">http://docs.jquery.com/Ajax</a></p> <p>However, it would be MUCH easier for you to just make it so that form elements are made empty when they become invisible, and then make them optional on the server side.</p> <p><strong>EDIT</strong> There's no way I can think of to have PHP not process them unless you send it instructions one way or another. Anything that has a name will be processed, except checkboxes, which are indicated off by lack of a value. As far as I know, there is no way for PHP to tell what the visible status of a field was on the client side when the form was submitted.</p> <p>Perhaps you could add the names of disabled/invisible fields to an extra hidden field, concatenated by commas or something, and build the PHP to not process fields that appear in it. Otherwise you could manipulate the field names to start with proc_ and noproc_ or something, and use that as an instruction whether to process the field, but again you are just passing extra instructions to PHP.</p>
 

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