-
Recently Browsing 0 members
- No registered users viewing this page.
-
Similar Content
-
Download: Java All-in-One For Dummies, 7th Edition ($27 Value) — free for your email
By News Staff,
- ebook offer
- sponsored
- (and 3 more)
- 0 replies
- 3 views
-
Unofficial script lets in-place upgrade between Windows 10 and 11 Home / Pro editions
By hellowalkman,
- microsoft
- windows 11
- (and 11 more)
- 6 replies
- 2 views
-
Microsoft introduces TypeScript 5.4: Explore the latest features and enhancements
By zikalify,
- microsoft
- typescript
- (and 4 more)
- 11 replies
- 2 views
-
Learn Java with Projects (worth $44.99) but free in exchange for your email
By News Staff,
- packt
- ebook offer
- (and 2 more)
- 0 replies
- 3 views
-
JavaScript All-in-One For Dummies (worth $24) free in exchange for your email
By News Staff,
- ebook offer
- javascript
- (and 3 more)
- 0 replies
- 3 views
-
Question
kman1985
I used this contact form before, but for some reason it's not working correctly on my wordpress site ( http://duddydesign.c...fusion/contact/ ). I use javascript to validate the form. Looks like the javascript isn't running correctly because it shows the alert, but then it submits the form. I used the same script for the contact page @ http://www.tarnishta...ms/contact.html, so idk why it's not working. If someone could help me out it would be greatly appreciated. Thanks.
HTML
JAVASCRIPT
function FormValidator(theForm)
{
if (theForm.UserName.value == "")
{
alert("Please enter Name.");
theForm.Username.focus();
return (false);
}
if (theForm.Subject.selectedIndex == 0 || (theForm.Subject.selectedIndex != 3 && theForm.OtherSubject.value != ""))
{
alert("Please select a Valid Subject.");
theForm.Subject.focus();
return (false);
}
if (theForm.Subject.selectedIndex == 3 && theForm.OtherSubject.value == "")
{
alert("Please enter Other Subject.");
theForm.OtherSubject.focus();
return (false);
}
if (theForm.Comments.value == "")
{
alert("Please fill in Comment Area.");
theForm.Comments.focus();
return (false);
}
if (theForm.UserEmail.value == "")
{
alert("Please enter E-Mail Address.");
theForm.UserEmail.focus();
return (false);
}
return (true);
}
function SetOther(theForm)
{
theForm.Subject.selectedIndex = 3;
return (true);
}
[/CODE]
Link to comment
Share on other sites
3 answers to this question
Recommended Posts