|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Hi,
I'm having a problem with form validation with the script I'l post bellow. Thanks in dvance for any help. I have one "Register" form and a "Login" form on the same page and when I try to login without entering any values, the alert bos shows the unfilled fields fo the "Register" form ?! How may I validate each one separately using the following script (I use in double, one for each form): <script language="JavaScript1.2" type="text/JavaScript1.2"> function validate(login) { login=document.forms[0]; var msgStr=""; if(login.username.value=="") msgStr+="• No Username, \r\n"; if(login.password.value=="") msgStr+="• No Password, \r\n"; if(msgStr!="") { msgStr=msgStr.substring(0,msgStr.lastIndexOf(",")); alert(msgStr); return false; } else { return true; } } </script>
__________________
----------------------------------------------------------------------------- If a word can't save lives, silence may probably kill - Preventing suicide is your task to!... |
|
#2
|
|||
|
|||
|
This is the wrong forum for this
![]() Go post again in the HTML, Javascript & CSS forum. |
|
#3
|
||||
|
||||
|
Hi,
Thanks for the post. It was a mistake ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Two forms validation on same file - help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|