Author |
Topic  |
blackinwhite
Average Member
  
Turkey
657 Posts |
Posted - 15 May 2002 : 14:44:36
|
how about that? just put the code between your <head> tags.
I am using that for my forum forms.
<!-- Javascript function to check the submitted form has been filled in correctly before submitting --> <SCRIPT language="JavaScript"> <!-- Hide from older browsers //Check the enquiry form is filled in correctly function CheckForm () {
//Initialise variables var errorMsg = "";
//Check for a last name if (document.FormName.SelectBox.value == "Other"){ errorMsg += "\n\tError: \t- Sorry, please enter a value for 'Other'."; } //Check for a last name if (document.FormName.SelectBox.value == ""){ errorMsg += "\n\tError: \t- Sorry, please enter a value for 'Other'."; } //If there is aproblem with the form then display an error if (errorMsg != ""){ msg = "______________________________________________________________\n\n"; msg += "Form wasn't sent because you didn't fill one or more of necessary fields.\n"; msg += "Please fill in the necessary fields and try again.\n"; msg += "______________________________________________________________\n\n"; msg += "Following fields must not be blank: -\n"; errorMsg += alert(msg + errorMsg + "\n\n"); return false; } return true; } // --> </script>
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 15 May 2002 : 14:45:29
|
I'll have a look at it in a couple hours. Get back to you as soon as I do it.
------------------------------------------------- Installation Guide | Do's and Dont's | MODs |
 |
|
blackinwhite
Average Member
  
Turkey
657 Posts |
Posted - 15 May 2002 : 14:48:23
|
I forgat to mention, and add
onSubmit="return CheckForm(); in form part like,
<form method="post" name="FormName" action="form.asp" onSubmit="return CheckForm();">
|
 |
|
ruirib
Snitz Forums Admin
    
Portugal
26364 Posts |
Posted - 15 May 2002 : 20:13:14
|
FrutZle,
I've emailed you your new validation script. As far as I could test it, it works. That was some pretty neat validation code. I've learned a bit with it. Didn't know Dreamweaver could do it.
Let me know how it goes.
------------------------------------------------- Installation Guide | Do's and Dont's | MODs |
 |
|
Roland
Advanced Member
    
Netherlands
9335 Posts |
Posted - 17 May 2002 : 12:07:53
|
quote:
FrutZle,
I've emailed you your new validation script. As far as I could test it, it works. That was some pretty neat validation code. I've learned a bit with it. Didn't know Dreamweaver could do it.
Let me know how it goes.
Sorry I didn't get back to you sooner, at least here, but we've been having some problems with one of our copy/print machines and I haven't had time to do much online yesterday.
Anyway, Ruirib gave me a great solution so I'm out of trouble.
Dreamweaver can't do that validation by default, at least versions 3 and 4 can't, so I downloaded an extention a long time ago. I checked Macromedia's download centre, but they don't have it anymore and unfortunately I have so many of them that I don't know which file is the one for that extention (short, indescriptive file names ).
Thank you all for your help. I really appreciate it, even if I don't use your codes.

http://www.frutzle.com
Snitz Exchange | Do's and Dont's |
 |
|
Topic  |
|