[Javascript] Required Checkboxes and Text boxes on a form

Alan Easton alan.easton at unn.ac.uk
Mon Apr 30 09:27:47 CDT 2001


Hi,
For checking check boxes they would already be elements in a form, so you
would run a onSubmit function to check the check boxes and the text boxes.

The checkboxes function could look something like this:

function check() {
if (!form.name_of_checkbox.checked) {
alert ("You have tick the box");
form.name_of_checkbox.focus();
return false;
}

A function to check the text fields are filled, a basic check:
function check() { 
if (form.name_of_textfield == false){	
alert ("Please enter some text");
form.name_of_textfield.focus();
return false;
}	
return true;
}

Not to sure of the exact syntax, but I think this will get you close enough
to help.

AE...
-----Original Message-----
From: Ronda Mitchell [mailto:rmitchel at fau.edu]
Sent: Monday, April 30, 2001 3:08 PM
To: javascript
Subject: [Javascript] Required Checkboxes and Text boxes on a form



Hello all of you brilliant people -
I have a form that has mostly checkboxes, but also some text boxes of which
ALL have to be required before processing.

What series of code would be required to insure both the checkboxes and the
text boxes are required before accepting the submitted form??

Any advice would be appreciated.

Thanks.

Ronda Mitchell
Training Coordinator
IRM/ACS
Florida Atlantic University
rmitchel at fau.edu
561-297-6787


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list