I have a dynamic form where groups of checkboxes are shown/hidden based on combo boxes' onChange handlers, and would prefer that the state of hidden checkboxes weren't passed along on form submission:
I'd initially thought to walk the form on submission and just un-check hidden checkboxes, i.e.
But determining the visibility/display property of those form elements seems problematic and my Google chops don't seem to be helping much.
The elements' visibility is set with Javascript:
Again, my main objective is not to submit values for hidden form objects. Anyone have any ideas how I can accomplish that, either by negating their values based on visibility or some other means?
I'd initially thought to walk the form on submission and just un-check hidden checkboxes, i.e.
Code:
for(i=0; i<form.elements.length; i++)
{
if(form.elements[i].type=="checkbox")
{
if (form.elements[i].style.display == "none") {
form.elements[i].checked = false;
}
}
}
But determining the visibility/display property of those form elements seems problematic and my Google chops don't seem to be helping much.
The elements' visibility is set with Javascript:
Code:
document.getElementById('theItemID').style.display = 'none';
OR
document.getElementById('theItemID')style.display = '';
Again, my main objective is not to submit values for hidden form objects. Anyone have any ideas how I can accomplish that, either by negating their values based on visibility or some other means?