hi,
in my project i used jsp form..if i enter the values it should be added in XML file..i used check boxes in my form..if i select more than one it is not updating in the XML file...can anyone help me out...here is the code...
thanks in advance,
madhu.
in my project i used jsp form..if i enter the values it should be added in XML file..i used check boxes in my form..if i select more than one it is not updating in the XML file...can anyone help me out...here is the code...
Code:
test.form <input type="checkbox" name="colors[]" value="blue" id="blue">Blue <br> <input type="checkbox" name="colors[]" value="red" id="red">red <br> <input type="checkbox" name="colors[]" value="green" id="green">green <br>
Code:
function validate()
{
var chks = document.getElementsByName('colors[]');
var hasChecked = false;
for (var i = 0; i < chks.length; i++)
{
if (chks[i].checked)
{
hasChecked = true;
break;
}
}
if (hasChecked == false)
{
alert("Please select at least one.");
return false;
}
return true;
}
madhu.
Comment