Women in Technology

Hear us Roar



Article:
  Working with Forms in PHP, Part 1
Subject:   a solution with javascript
Date:   2003-10-07 10:34:00
From:   anonymous2
put unchecked checkbox to value '0',recheck it and submit the form for treatement
an example with a generic function ti use with onchange event:


function checkbox_uncheck(nameForm, nameChkBox){
//goal: capture evt 'uncheck'
//usefull ONLY if you send a form only with 'this' checkbox
//you must after uncheck this one if value=0!!
if(window.document.forms[nameForm].nameChkBox.checked == false){
window.document.forms[nameForm].nameChkBox.value='0';
window.document.forms[nameForm].nameChkBox.checked=true;
window.document.forms[nameForm].submit();
}