If I submit a disabled text field via POST, what will the resulting value be on the action page?
For example, I have:
<table border=0 cellpadding=4 cellspacing=0>
<tr><td>
<input type="checkbox" id="chk_$item"
onClick="javascript:handleClick('$item')">
</td><td>
<input type="text" id="txt_$item" name="addresses[]" value="$item">
</td></tr>
<tr><td>
...etc...
</td></tr>
</table>
the handleClick()
javascript function checks if chk_$item
is checked, if not, it disables the txt_$item
text field.
When I submit it, all of the text fields go to an addresses[]
array in a PHP script.
But, can I prevent the field from submitting anything if it is disabled? Will it do this by default? If not, how should I change the behavior? (I really don't want to clear the fields when they get disabled).
Disabled inputs will not be submitted with the form; that's part of the defined behavior of disabled
, cf. W3C HTML 4.01 Form docs.