I have a set of check-boxes, which under certain conditions have their DIV container element hidden.
The problem is that values from these check-boxes are not sent through $_POST
when they are not visible. How can I force them to be sent?
I have a set of check-boxes, which under certain conditions have their DIV container element hidden.
The problem is that values from these check-boxes are not sent through $_POST
when they are not visible. How can I force them to be sent?
- how are you imposing invisibility? are you removing them from the html? visiblility:hidden? or display:none? and what data are contained and why are they hidden? – Joseph Commented Nov 18, 2011 at 20:03
- 4 Checkboxes are not sent unless they are checked – Laurence Burke Commented Nov 18, 2011 at 20:04
- I'm not hiding them directly, I'm just hiding their container with $(el).hide(). This is what is confusing me... – Alex Commented Nov 18, 2011 at 20:06
- Are you using AJAX to post the data to the server? – zzzzBov Commented Nov 18, 2011 at 20:10
- 1 yes, I'm using serialize() to get the form fields data... – Alex Commented Nov 18, 2011 at 20:19
2 Answers
Reset to default 9It is not the visibility that is affecting if you can see the checkbox values. Checkbox values are not sent if the checkbox is not checked.
If the value does not exist in $_POST it has not been checked.
http://www.html-form-guide./php-form/php-form-checkbox.html
.hide() set the diplay to none;
visibility:hidden would work.
$(el).css('visibility', 'hidden');