Reply
Failure getting form data to ASP script
Old 04-27-2006, 12:30 PM Failure getting form data to ASP script
Novice Talker

Posts: 7
I'm having a problem getting validated form data to my asp script. If I don't validate, the data is passed with no problem. Once I check the form for user input, the asp script does nothing. Anyone have an idea? Listed here is my function CheckForm() and my Form ID. I'm using the same form field Name in my asp script. Does the variable name change once it is verified? Thanks for your help!


function CheckForm()
{

if (document.EmailForm.SenderName.value=="" || document.EmailForm.SenderName.value.indexOf(" ")==0)
{
alert("Please enter a value for Name.");
document.EmailForm.SenderName.focus();
return false;
}

else if (document.EmailForm.EmailAddress.value=="" || document.EmailForm.EmailAddress.value.indexOf(" ")==0)
{
alert("Please enter a value for email address.");
document.EmailForm.EmailAddress.focus();
return false;
}
else if (document.EmailForm.EmailAddress.value.indexOf(at) ==-1){
alert("You have forgotten an @ in the email address")
document.EmailForm.EmailAddress.focus();
return false;
}
else if (document.EmailForm.EmailAddress.value.indexOf(dot )==-1){
alert("You have forgotten a dot in the email address")
document.EmailForm.EmailAddress.focus();
return false;
}


else if (document.EmailForm.Subject.value=="" || document.EmailForm.Subject.value.indexOf(" ")==0)
{
alert("Please enter a value for Subject.");
document.EmailForm.Subject.focus();
return false;
}


else if (document.EmailForm.Message.value=="" || document.EmailForm.Message.value.indexOf(" ")==0)
{
alert("Please enter a value for Message.");
document.EmailForm.Message.focus();
return false;
}

return true
}

************************************
Form ID Code:

<form id="EmailForm" name="EmailForm" onsubmit="return CheckForm()" action="emailformconfirm1.asp" method="post">
GClarkOX is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 05-03-2006, 02:23 PM Re: Failure getting form data to ASP script
funkdaddu's Avatar
Web Design Snob

Posts: 636
Only trouble I ran into was I had to define "at" to be "@" and "dot" to be ".".

You may want to have the "return true" be in the else portion of the that if/else
Code:
...
alert("Please enter a value for Message.");
document.EmailForm.Message.focus();
return false;
} else {
return true
}
Other than that, I don't know.

Last edited by funkdaddu : 05-03-2006 at 02:25 PM.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Reply     « Reply to Failure getting form data to ASP script
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11497 seconds with 13 queries