I have a simple validation I need to do. I need to just make sure that a Checkbox is checked, and that a Text field has content. Sounds simple but I cannot find any thing that has a check and a text field.
Here what I have. Can I modify this script to do this? A Checkbox MUST be checked and Text field MUST be filled out. This currently does the text field fine, but no Checkbox obviously.
How can I add a checkbox validation to this?
Thats it. Any help is appreciated.
var textFields = ["digsig"];
function validateForm( )
var oops = ""; // must initialize this!
var form = document.sig;
for ( var t = 0; t < textFields.length; ++t )
var field = form[textFields[t]];
var value = field.value.replace(/^\s+/,"").replace(/\s+$/,""); // trim the input
if ( value.length < 1 )
oops += "You MUST enter your Digital Signature";
if ( oops != "" )
alert("ERROR:" + oops);