prakash Posted October 8, 2007 Share Posted October 8, 2007 I cannot have javascript field validation with the doctype <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> how can I use javascript field validation with using the same doctype. my code is as below <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> new document </title> <script language="JavaScript" type="text/javascript"> <!-- function chkLoginValid() { if (login.memberEmail.value=="") { alert("E-Mail Required."); login.memberEmail.focus(); return (false); } else if (login.memberEmail.value.indexOf('@')==-1 || login.memberEmail.value.indexOf('.')==-1) { alert("Invalid E-Mail."); login.memberEmail.focus(); return (false); } else if (login.memberPassword.value=="") { alert("Password Required."); login.memberPassword.focus(); return (false); } else { return (true); } } //--> </script> </HEAD> <BODY> <form name="login" method="post" action="memberAction.php" onSubmit="return chkLoginValid();"> E-Mail Address: <input type="text" name="memberEmail" /><input type="hidden" name="cmd" value="_memberLogin" /><br> Password: <input type="password" name="memberPassword" /><br> <input type="submit" value="Login"> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
d22552000 Posted October 8, 2007 Share Posted October 8, 2007 All you can do is match it by wildcards: <!DOCTYPE html PUBLIC "-//W3C//DTD *//EN" "http://www.w3.org/TR/*"> Hope that helps. Quote Link to comment Share on other sites More sharing options...
prakash Posted October 8, 2007 Author Share Posted October 8, 2007 <!DOCTYPE html PUBLIC "-//W3C//DTD *//EN" "http://www.w3.org/TR/*"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> this is not working anyway Quote Link to comment Share on other sites More sharing options...
d22552000 Posted October 10, 2007 Share Posted October 10, 2007 I know. that is just the TEMPLATE of a doctyp,e if you run that throuh regular matching on a text filed then the user could enter any of hte following and be allowed through: <!DOCTYPE html PUBLIC "-//W3C//DTD *//EN" "http://www.w3.org/TR/*"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" Do you; understand what I mean though, wildcard matching...? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.