Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Submit button

Status
Not open for further replies.

MONFU

Programmer
Oct 27, 2001
35
MT
Hello All,

I have a problem with the submit button. I have an image as a replacement to the Submit button and then I include an OnClick Method to submit, ie, onClick = formName.submit() and that works fine. However, I have a function checkSubmit that checks that all the fields are entered, however, I do not know how to call this function. I tried in the Form action as follows:-

<form action=&quot;contactMail.asp&quot; method=&quot;post&quot; name=&quot;contactForm&quot; id=&quot;contactForm&quot; onSubmit=&quot;return checkSubmit()&quot;>

but it is not working. How can I make it work?

Thanks for your help
 
Hi

hey remove the return checkSubmit()&quot; from submit action
and do following it will work

<a href=javascript:checkSubmit()><Img src =&quot; .jpg></a>

rgds

prasad
 
.. assuming that you call the submit method within the checkSubmit function. codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
also , you haven't to include any script above your CheckSubmit() function.
 
Hi parasandalone,

I did what you told me to do, but the problem now is that if I leave the name field empty for example, since the checksubmit() function returns false, the page displays the error message, ie &quot;Please enter your name&quot; and when I click ok, it only displays false on the page. What is happening?

Here is my code:-

if (contactForm.firstName.value == &quot;&quot;)
{
alert(&quot;Please enter your name&quot;)
contactForm.firstName.focus()
contactForm.firstName.select()
return false
}
return true

Thanks for your help
 
try

if (contactForm.firstName.value == &quot;&quot;)
{
alert(&quot;Please enter your name&quot;);
contactForm.firstName.focus();
return false;
}
else
{
return true;


admin@onpntwebdesigns.com
 
Ok I solved it. I created a variable and if the variable is not changed, ie all the fields are entered, then FormName.submit()

Thanks just the same
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top