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

submit button - onclick

Status
Not open for further replies.

JanS

Technical User
Feb 21, 2001
77
AU
Hi,

Now that my problems with passing data between forms are solved, I am trying to validate data. I want to be able to run a procedure when the user clicks on the submit button. But when I add onclick="check_params" to run the check_params code, I get the following error when the button is clicked:

"check_params" is undefined.

How should I be referencing (and declaring) the procedure? Should it be included in <%...%> or defined in <SCRIPT>....</SCRIPT> tags??

thanks again
jan
 
The function needs to be declared between <SCRIPT> tags but there is also an error in your function call. You need the following:

onClick=&quot;return check_params()&quot;

Hope this helps Mise Le Meas,

Mighty :)
 
In the VBScript Equivelant, you do not need the onsubmit attribute, you can use the following code:

<script language=vbscript>
function MyForm_onsubmit()
<--frm testing code goes here-->
end function
</script>

and then in the body here is the form:

<form ID=MyForm Method=Post Action=&quot;PosttoPage.asp&quot;>
<input type=Submit Name=&quot;SubmitMe&quot; Value=&quot;Submit&quot;>

VBScript already handles the onsubmit event, you just need to know how to make use of it.

Hope this helps :)

Tazzmann
 
I have a followup question to this.

If I have a form, whic does not have a submit button, but it has a button with an onClick event. This should run a vbscript function to submit the form. At the moment, it successfully runs a javascript function.

The header of my form is as follow:
<form name=&quot;myForm&quot; method=post action=&quot;processForm.asp&quot;>

Is there a vbscript equivalent to the following in javascript:
document.myForm.submit()
and
document.location.reload()

I need to use a function to submit the form instead of just using a submit button.
At the moment, it works with javascript but I want to use vbscript instead.
Thanks
 
I use the following at it works fine...

<script language=VBScript>
function btnName_onclick()
MyForm.submit
end function
</script>

The only problem that I have noticed on this, is that when you have submitted a form to THIS page which also contains a form, then doing the submit this way does not fire the onsubmit event but the form on THIS page will still post correctly. Tazzmann
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top