Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
using javascript button to submit form - verify not working
Old 07-19-2009, 07:43 PM using javascript button to submit form - verify not working
ericson3000's Avatar
Experienced Talker

Posts: 40
Name: Bob Davis
Location: Los Angeles, CA
Trades: 0
Hi - I have a form on my site that is submitted the usual way, with a button in the form. It works fine and verifies that the email in the form is properly filled out. Like this:

<form action="EmailAction.cfm" method="post" name="SupportForm" onSubmit="return CheckSupportForm(this)">
<input class="forms1" type="text" name="Email" size="25" tabindex="1">
<input type="image" name="SubmitFormBut" src="img/Submit.gif" alt="" tabindex="34" align="absmiddle" border="0" height="22" width="91">
</form>


But I need to replace the button with a javascript button (so that people that have javascript turned off cannot submit the form). But when I do it this way, although the button will submit just fine, it does not verify the email format. Does anyone have an answer to why it does not verify?

<form action="EmailAction.cfm" method="post" name="SupportForm" onSubmit="return CheckSupportForm(this)">
<input class="forms1" type="text" name="Email" size="25" tabindex="1">
<img src="img/Submit.gif" width="91" height="22" border="0" name="SubmitFormBut">
</form>
<SCRIPT language="JavaScript1.2">
function submitform()
{
document.SupportForm.submit();
}
</SCRIPT>
ericson3000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-19-2009, 09:20 PM Re: using javascript button to submit form - verify not working
treyk4's Avatar
Skilled Talker

Posts: 89
Name: Trey
Trades: 0
You could put the javascript in the action attribute (although this is bad coding practice).
Ex: <form action="javascript:CheckAndSubmitForm(this);" method="POST">

HTH,
-Trey
treyk4 is offline
Reply With Quote
View Public Profile
 
Old 07-20-2009, 04:36 PM input type="Button" not working in my validating form
ericson3000's Avatar
Experienced Talker

Posts: 40
Name: Bob Davis
Location: Los Angeles, CA
Trades: 0
Hi - I have a question about a form I am creating. Basically it is very simple but needs to verify that the email address is a valid type. My form starts like this:

<form action="EmailAction.cfm" method="post" name="SupportForm" onSubmit="return CheckSupportForm(this)">

I want it to end with the <input type="Button"> so that it will only work if they have javascript turned on. But it doesn't work. You can click it but it goes nowhere. It works if I use <input type="image" src="whatever.gif">.

Does anyone have any pointers? Is it because I use onSubmit in the beginning of the form, because I need to use onSubmit="return CheckSupportForm(this)".
ericson3000 is offline
Reply With Quote
View Public Profile
 
Old 07-20-2009, 04:47 PM Re: input type="Button" not working in my validating form
GeekSpecialties's Avatar
Super Talker

Posts: 132
Name: Leonard
Location: Minnesota, USA
Trades: 0
Use a submit button.
Code:
<input type="submit" value="Submit" />
GeekSpecialties is offline
Reply With Quote
View Public Profile Visit GeekSpecialties's homepage!
 
Old 07-20-2009, 04:48 PM Re: using javascript button to submit form - verify not working
ericson3000's Avatar
Experienced Talker

Posts: 40
Name: Bob Davis
Location: Los Angeles, CA
Trades: 0
Thanks - but my current form action is action="EmailAction.cfm" which send out a formatted email. How would I implement your method but still go to my EmailAction.cfm?
ericson3000 is offline
Reply With Quote
View Public Profile
 
Old 07-20-2009, 04:54 PM Re: input type="Button" not working in my validating form
ericson3000's Avatar
Experienced Talker

Posts: 40
Name: Bob Davis
Location: Los Angeles, CA
Trades: 0
That works when I have javascript on. But when I turn my browser's javascript off, it throws me to an error page. I want it to just not work. To go nowhere.
ericson3000 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to using javascript button to submit form - verify not working
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.22657 seconds with 12 queries