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

How to call a function? Beginner 3

Status
Not open for further replies.

MEGUIA

Programmer
Sep 26, 2001
62
PR
Hello,

I've created an ActiveX dll in VB and all I want to call the dll page with the value passed from the event button onclick(). I have this code but It give a headeache because I read all the thread from this forum and I don't see the error. Any advice would be great. Thank You.

Code:
<html>

<head>

<%@ LANGUAGE javascript>
<%
function varDial(textstring)
{
var outpostdb = Server.CreateObject(&quot;Tapi.Clsdial&quot;)
outpostdb.cmdStartSession(textstring)
set outpostdb = nothing
}
%>
</script>

</head>
<body>
<form align=&quot;center&quot;>
<p align=&quot;center&quot;>
<input name=&quot;text1&quot; type=&quot;text&quot; id=&quot;text1&quot;>
<input name=&quot;print&quot; type=&quot;button&quot; value=&quot;DIAL&quot; onClick=&quot;varDial(text1.value)&quot;>
</p>
</form>
</body>
</html>
 
This would appear to be server-side code:

<%@ LANGUAGE javascript>
<%
function varDial(textstring)
{
var outpostdb = Server.CreateObject(&quot;Tapi.Clsdial&quot;)
outpostdb.cmdStartSession(textstring)
set outpostdb = nothing
}
%>

This appears to be client-side coding:

<input name=&quot;print&quot; type=&quot;button&quot; value=&quot;DIAL&quot; onClick=&quot;varDial(text1.value)&quot;>

Since you're not submitting the form to the webserver for processing you can't call the server-side code via an onclick button unless you submit the form.

I could be wrong though. ====================================
I love people. They taste just like
chicken!

 
you cannot call server side code (subs or functions) in a page. you need to process the script someway, more then likely after a form submission. server side (ASP) is interpurted when the page is loaded and not after that, so there is no run-time ASP functionality in a page after the page has been loaded.
so in what you have you would due
pageone.asp
<%@ LANGUAGE javascript>
<%
dim textstring
textstring = Request.Form(&quot;text1&quot;)
{
var outpostdb = Server.CreateObject(&quot;Tapi.Clsdial&quot;)
outpostdb.cmdStartSession(textstring)
set outpostdb = nothing
}
%>

pagetwo.htm
<html>
<head>
</head>
<body>
<form align=&quot;center&quot; action=&quot;pageone.asp&quot; method=&quot;POST&quot;>
<p align=&quot;center&quot;>
<input name=&quot;text1&quot; type=&quot;text&quot; id=&quot;text1&quot;>
<input type=&quot;Submit&quot; value=&quot;dial&quot;>
</p>
</form>
</body>
</html> A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
You could add a hidden text box and put a &quot;1&quot; in it when the onclick action is taken. Then submit the page:


<form name=&quot;frm1&quot; align=&quot;center&quot; method=&quot;POST&quot; action=&quot;samePage.asp&quot;>
<p align=&quot;center&quot;>
<input name=&quot;text1&quot; type=&quot;text&quot; id=&quot;text1&quot;>
<input name=&quot;print&quot; type=&quot;button&quot; value=&quot;DIAL&quot; onClick=&quot;frm1.hidden.value='1'&quot;>
</p>
<input type=&quot;hidden&quot; name=&quot;hidden&quot; value=&quot;&quot;>
</form>

Now I know my code is incorrect but I hope you get the idea. Then when the page loads get the value of the submitted hidden text box and see if it is &quot;1&quot;, if it is do whatever you want and if it's not do something else.

====================================
I love people. They taste just like
chicken!

 
your not only right mithrilhall but faster at typing. [lol] A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top