my code:
<INPUT TYPE="checkbox" NAME="cb" value="1">
after submit form,i can get cb==1
,if cb
element is checked,
i want to get cb==0
,if cb
element do not to be checked,how to implement it?
BTW: can't change receive page,like:
if(cb==null)cb=0;// no no no..
i want implement it at web front client.
i tried like this:
<INPUT TYPE="hidden" NAME="cb" value="0"> <!--add this line-->
<INPUT TYPE="checkbox" NAME="cb" value="1">
if cb
is not checked,it can override <INPUT TYPE="hidden" NAME="cb" value="0">
else i can get cb==0
.
but i feel this solution is not good.
any idea? thx~ :)
thanks wowo_999 for comment:
"I'd just ignore the value of the checkbox period and use it to set the value of your hidden field based on if its checked or not. The way you suggest will send the value for cb 2x in your query string if the checkbox is checked." – wowo_999
in database,i set cb field default value as"0",but when i insert or update,if it is null,show: "java.sql.SQLException: Column 'cb' cannot be null",so,i need cb==0,not null.(i can't ignore cb field in sql query string,because i maybe need update cb to "0".)