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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Submit problem

Status
Not open for further replies.

meldrape

Programmer
May 12, 2001
516
US
Greetings,

I'm using the following script so when users are filling out a form and hit enter, it doesn't accidentally submit before they are finished:

<script language =&quot;javascript&quot;>
function onSubmit()
{
document.registration.submit();
}
</script>

Then my input button looks like this:

input type=button value=&quot;Send&quot; onClick=&quot;onSubmit()&quot;>

On my next page, I run a SQL statement to update a database. It won't update if I use this script. When I take the script out and change the button type to submit and remove the reference to the onclick, it works great. Any thoughts? Does the button have to be type=submit for the database to update? Any thoughts or workarounds would be greatly appreciated. THanks.

 
It might be a conflict, as onSubmit is a form-event.
Try something like this...

Code:
<script language =&quot;javascript&quot;>
function Submitter()
{
document.forms.registration.submit();
}
</script>


<FORM NAME='registration'>
...
<Button onClick=&quot;Submitter&quot;>Submit</button>
...
</FORM>
This is not a bug - it's an undocumented feature...
;-)
 
I'm still online, so if it misbehaves drop me another line :) This is not a bug - it's an undocumented feature...
;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top