form validation

Codes here !

Moderators: macek, egami, gesf

Post Reply
User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Post by Joan Garnet » Mon Dec 30, 2002 2:09 pm

You should use javascript to do that.
It's a waste of validating a form with server side language, and it overcharges the net.
Actually javascript was made exactly for this reason.

There's a function that works quite good -->
indexOf
It checks for a string in a string.

Code: Select all

var my_string = "jgarnet@ebcn-records.com";
var check_a = my_string.indexOf('@');
var check_dot = my_string.indexOf('.');
if ( (check_a == -1) || (check_dot == -1) )
 {
  alert('Your email is not valid');
 }
else
 alert('Thanks!');
}


bye!

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests