| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
javascript, form validation
Here is my javascript code:
<SCRIPT> function validate() { mNv=mainform.Name.value; pass=mainform.password.value; if (mNv=='') { alert('required'); event.returnValue=false; } pass=mainform.password.value; if (pass=='') { alert('required'); event.returnValue=false; } } Right now it sends out an alert box, but I want it to write the response to the page next to the required field, does anyone know how to do that? |
|
#2
|
||||
|
||||
|
Hi
You will have to add a DIV next to each field: Code:
<input type="password" name="password"> <div id="epassword" style="display: inline;"></div> Code:
epassword.innerHTML='This field must be completed'; |
|
#3
|
||||
|
||||
|
Awesome, thanks.
Quote:
|
|
#4
|
||||
|
||||
|
Salvation at last!
Thanks for the short, quick, and easy method to do this. I previously thought that it would take to much code to do something like this using JavaScript, so I did it on the server-side only. Good work! ![]() See my poll where I discuss "JavaScript Alerts Are Evil!" |
|
#5
|
||||
|
||||
|
Does anyone know why this DHTML approach does not work in these browsers:
Netscape, Mozilla, and Firefox (All fairly new versions). It works only in Internet Explorer and Opera. |
|
#6
|
||||
|
||||
|
|
|
#7
|
||||
|
||||
|
Thanks selwonk!
|
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > javascript, form validation |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|