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

Calling VBScript and JavaScript functions for the same event

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
Is it possible to call a VBScript function and a JavaScript function for the same event?
When I submit a form I want the VbScript function toexecute then the JavaScript. Please refer to the code below. Any help appreciated.

Code:
<Script language='javascript'>
Function validate()
{
return true;
}
</Script>
<Script language='vbcript'>
function frm_onsubmit()

End Function
</Script>

<form name=frm method='post'....>
........
<type=submit onsubmit='return validate()'>

</form>
 
If I read correctly, you want something to happen when you submit the form. Based on this assumption, you do not need a separate VBScript function for the form onsubmit, this is already part of HTML. Just modify your code a little:
Code:
<Script language="javascript">
Function validate()
{
return true;
}
</Script>

<form name="frm" method="post" onsubmit="return validate()">
<input type="submit">
</form>

-----------------------------------------------------------------------------------------------------
&quot;If you can't explain something to a six-year-old, you really don't understand it yourself.&quot;
-- Albert Einstein
 
Thank you.
I agree that I don't need to call two different functions.
I came across this situation when I was working on something and just out of curiosity,
is it possible to call two separate functions on onSubmit event.
 
It is possible to call two separate functions within a single onsubmit event. However, I do not think it is possible to call two separate functions in two separate languages (as you had originally wanted). And even if it is, it is likely not very good programming practise.

To call the two functions, incidentally, would be something akin to the following:
Code:
<form name="frm" method="post" onsubmit="return validate();","return anotherFunction();">

-----------------------------------------------------------------------------------------------------
&quot;If you can't explain something to a six-year-old, you really don't understand it yourself.&quot;
-- Albert Einstein
 
You can call only the VBS function and then from within it call the JS function
function frm_onsubmit()
'caling validate
validate
End Function


________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top