PDA

View Full Version : Check to see if fields are filled help



KaoS
Dec 1st, 2002, 04:50 AM
Ok i got fields that are required to fill in, what would be the code if i wanted it to say a message if those wernt filled when they click submit???

Also how do i make it sos that in the email field u must have @, and . in it?

Thankz!!

chrismiceli
Dec 1st, 2002, 05:03 AM
beetle, another member has a program on his site called fvalidate, it is in his sig, look for it. you are going to give us code, but for the e-mail, try this


document.formname.inputname.value = test;
if (test.indexOf("@") == -1) {
alert("empty field")
}

i think that should work, haven't used indexOf() in a while.

KaoS
Dec 1st, 2002, 05:10 AM
so wait, heres my page http://www.geocities.com/unreallegacy/index2.html how would i add it to that page???

Ya i know ewwww geocities :P

KaoS
Dec 1st, 2002, 05:39 AM
Hello all you expert people :thumbsup:

:rolleyes:

Jeepers
Dec 1st, 2002, 01:05 PM
Within the form tag put onSubmit="return function-name()" function-name being the name of the function that contains the script.

You might also want to take a look at this thread http://www.codingforums.com/showthread.php?s=&threadid=10767