checking textfields

R

roN

Hi,
I'm getting desperate, I just wanna check if mandatory fields are filled
with text on http://paykiosks.net/contact_new.htm but it somehow just
wouldn't work. :(
s mall piece looks like:
[js]
if (document.Formular.first_name.value == "")
{
alert("Please enter your firstname!");
document.Formular.first_name.focus();
return false;
}
[/js]
HTML:
<form name="Formular" method="post" onSubmit="return chkform()"
action="http://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8">
....
....
....
<input type="text" size="20" name="first_name" class="flat">
What's wrong??? huh? can't see it...
I'd appreciate if anyone could have a look at it and tell me where i'm going
wrong. Thank you!

Ron
 
T

Tom Cole

roN said:
Hi,
I'm getting desperate, I just wanna check if mandatory fields are filled
with text on http://paykiosks.net/contact_new.htm but it somehow just
wouldn't work. :(
s mall piece looks like:
[js]
if (document.Formular.first_name.value == "")
{
alert("Please enter your firstname!");
document.Formular.first_name.focus();
return false;
}
[/js]
HTML:
<form name="Formular" method="post" onSubmit="return chkform()"
action="http://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8">
...
...
...
<input type="text" size="20" name="first_name" class="flat">
What's wrong??? huh? can't see it...
I'd appreciate if anyone could have a look at it and tell me where i'm going
wrong. Thank you!

Ron

I don't really see anything wrong. I created the following test page
based on your code and it worked as I expected. Copy and paste it and
see if you get the same results.

<html>
<head>
<script type="text/javascript">
function testIt() {
if (document.Formular.first_name.value == "")
{
alert("Please enter your firstname!");
document.Formular.first_name.focus();
return false;
}
}
</script>
</head>
<body>
<form name="Formular" onsubmit="return testIt();"
action="javascript:alert('Submitted');">
<input type="text" name="first_name"/><br/>
<input type="submit" value="Submit"/>
</form>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top