473,416 Members | 1,660 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

How to execute subroutines from button clicks?

I have read and tried every combination for hours. I'm sorry, but I
don't get it. How do I have a form with textboxes and buttons and
allow click events to execute a server function then display a
property on the client?

Here is code, albeit changed to show both paths I have tried to
follow, neither of which works. I also can't seem to find out how to
trap for the errors so I can see what's going wrong.

<%@ Language=VBScript %>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<%
Dim sNumber
sNumber = "102"

set etLine1 = Server.CreateObject("etTT40.etLine")
etLine1.Enabled = True
etLine1.DeviceName = "Analog Line 1(dxxxB1C1)"
etLine1.DeviceActive = True
response.write ("<br>etLine1.DeviceName: " & etLine1.DeviceName)
response.write ("<br>" & etLine1.DeviceActive)
'all above code works. I can even dial if I stick the dial
method here

Sub Dial()
etLine1.CallDial() ' Here is just get "error on page" at the
' bottom of my browswer
End Sub
%>

<SCRIPT LANGUAGE="VBScript">
<!-- This doesn't work, it just dials executes when the page loads
even when
I expect it to only get here with onclick
Sub Dial()
<%=etLine1.CallDial %>
end sub
-->
</SCRIPT>

</HEAD>
<BODY bgcolor="#B0E0E6">
End Sub

<FORM NAME="CallerID">
<p>Caller ID Number&nbsp;&nbsp;<input type="text"
name="TextCallerIDNumber" size="20" value="<%=sNumber%>">&nbsp;&nbsp;
<input type="button" name="btnDial" value="Dial This Number"
onclick="Dial()"></p>
<p>Caller ID Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
type="text" name="TextCallerIDName" size="20">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ; </p>
<input type="button" name="btnHangup" value="Hangup Call"
onclick="Hangup()">

'I even tried to put <%=CallDial() here to no avail

</FORM>
</HTML>

This is obviously a telephony program and in this sample, I just want
to be able to dial a call by pressing a button. The server has the
hardware on it and would dial the call from there. I also would like
to be able do dial into the server and the OnCallerID event should
fire. I then want to display the caller ID on the client side.
Thanks.

Fred
Jul 19 '05 #1
4 2416
Navigate to your page and View->Source and you'll probably see this

<SCRIPT LANGUAGE="VBScript">
Sub Dial()

end sub
</SCRIPT>

So clicking your button does nothing. ASP executes first and the resulting
HTML is handed to the browser for display.

The basic answer is that you can't do what you're wanting using standard ASP
coding. There are technologies that let you run things on the server via
things in script but without knowing the ins and outs of what you want it is
hard to advise further.

What does this CallDial do?

"Fred" <fd************@aol.com> wrote in message
news:57*************************@posting.google.co m...
I have read and tried every combination for hours. I'm sorry, but I
don't get it. How do I have a form with textboxes and buttons and
allow click events to execute a server function then display a
property on the client?

Here is code, albeit changed to show both paths I have tried to
follow, neither of which works. I also can't seem to find out how to
trap for the errors so I can see what's going wrong.

<%@ Language=VBScript %>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<%
Dim sNumber
sNumber = "102"

set etLine1 = Server.CreateObject("etTT40.etLine")
etLine1.Enabled = True
etLine1.DeviceName = "Analog Line 1(dxxxB1C1)"
etLine1.DeviceActive = True
response.write ("<br>etLine1.DeviceName: " & etLine1.DeviceName)
response.write ("<br>" & etLine1.DeviceActive)
'all above code works. I can even dial if I stick the dial
method here

Sub Dial()
etLine1.CallDial() ' Here is just get "error on page" at the
' bottom of my browswer
End Sub
%>

<SCRIPT LANGUAGE="VBScript">
<!-- This doesn't work, it just dials executes when the page loads
even when
I expect it to only get here with onclick
Sub Dial()
<%=etLine1.CallDial %>
end sub
-->
</SCRIPT>

</HEAD>
<BODY bgcolor="#B0E0E6">
End Sub

<FORM NAME="CallerID">
<p>Caller ID Number&nbsp;&nbsp;<input type="text"
name="TextCallerIDNumber" size="20" value="<%=sNumber%>">&nbsp;&nbsp;
<input type="button" name="btnDial" value="Dial This Number"
onclick="Dial()"></p>
<p>Caller ID Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
type="text" name="TextCallerIDName" size="20">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ; </p>
<input type="button" name="btnHangup" value="Hangup Call"
onclick="Hangup()">

'I even tried to put <%=CallDial() here to no avail

</FORM>
</HTML>

This is obviously a telephony program and in this sample, I just want
to be able to dial a call by pressing a button. The server has the
hardware on it and would dial the call from there. I also would like
to be able do dial into the server and the OnCallerID event should
fire. I then want to display the caller ID on the client side.
Thanks.

Fred

Jul 19 '05 #2
Fred wrote:
I have read and tried every combination for hours. I'm sorry, but I
don't get it. How do I have a form with textboxes and buttons and
allow click events to execute a server function then display a
property on the client?

Here is code, albeit changed to show both paths I have tried to
follow, neither of which works. I also can't seem to find out how to
trap for the errors so I can see what's going wrong.

<%@ Language=VBScript %>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<%
Dim sNumber
sNumber = "102"

set etLine1 = Server.CreateObject("etTT40.etLine")
etLine1.Enabled = True
etLine1.DeviceName = "Analog Line 1(dxxxB1C1)"
etLine1.DeviceActive = True
response.write ("<br>etLine1.DeviceName: " & etLine1.DeviceName)
response.write ("<br>" & etLine1.DeviceActive)
'all above code works. I can even dial if I stick the dial
method here

Sub Dial()
etLine1.CallDial() ' Here is just get "error on page" at the
' bottom of my browswer
End Sub
%>

<SCRIPT LANGUAGE="VBScript">
<!-- This doesn't work, it just dials executes when the page loads
even when
I expect it to only get here with onclick
Sub Dial()
<%=etLine1.CallDial %>
end sub
-->
</SCRIPT>

</HEAD>
<BODY bgcolor="#B0E0E6">
End Sub

<FORM NAME="CallerID">
<p>Caller ID Number&nbsp;&nbsp;<input type="text"
name="TextCallerIDNumber" size="20" value="<%=sNumber%>">&nbsp;&nbsp;
<input type="button" name="btnDial" value="Dial This Number"
onclick="Dial()"></p>
<p>Caller ID Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input
type="text" name="TextCallerIDName" size="20">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ; </p>
<input type="button" name="btnHangup" value="Hangup Call"
onclick="Hangup()">

'I even tried to put <%=CallDial() here to no avail

</FORM>
</HTML>

This is obviously a telephony program and in this sample, I just want
to be able to dial a call by pressing a button. The server has the
hardware on it and would dial the call from there. I also would like
to be able do dial into the server and the OnCallerID event should
fire. I then want to display the caller ID on the client side.
Thanks.

Fred


There are 5 ways that I know of to allow a user to cause server-side code to
execute by clicking a button:
1. Traditional form submission: the button submits the form to an asp page
containing the server-side code on the server, causing a page reload or a
new page to be displayed
2. Again: form submission, but using an IFrame in the target attribute of
the FORM tag, which will allow you to submit the form without unloading the
page.
3. Remote scripting - this has been deprecated, but many people still use
it. Do a Google search to find more information. Or look it up at
msdn.microsoft.com/library
4. If you do not need results returned from the server-side code, you could
use an IMG element, setting its src property to the url of the asp page
containing the server-side code
you wish to run
5. You can use the XMLHTTP (aka XMLHTTPRequest) object - again, you can find
info via Google or at msdn.microsoft.com/library

Do some research and decide which method you wish to use. Options 2-5 all
involve some client-side programming, making it off-topic in this newsgroup.
You should post any request for further information about these options
(after doing your own research
first, of course <grin> ) to the appropriate client-side coding newsgroups:
look for groups with "dhtml" in their names, or simply use the
..scripting.jscript newsgroup.

HTH,
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3
Thanks Bob and Adrian. I'll be doing a lot more research on all those
options. Adrian, I'll tell you what the program should do:

1. The user loads a web page with a form that has 2 text boxes, one
for callerID Name and the Other for CallerID number.

2. The user sees a button that says "dial"

3. I have a telephony device attached to my IIS server where the ASP
code is running. When the user telephones the extension attached to
that device, I want to use an event in an ActiveX on that machine
(etLine_OnCallerID) to display the CallerID information it has back on
the page the user is viewing. When they press the Dial button, it
will take the number out of the Caller ID number field, call them
right back on that number and play a wave file. This is a very simple
test program, ultimately it will do a lot more, but this will teach me
how to get information back and forth.

I realize also that there may be better ways to rethink the problem as
to where the information is and where it goes. For example, since all
the program stuff is really happening in ASP, maybe something "calls"
the ASP page and the ASP page pushes the CallerID info to the HTML
page. Then when the button is pressed on the HTML page, it somehow
refers back to that ASP page to execute the Dial subroutine or even
calls another ASP page.

The first part of the program works, if that is the proper place to do
it. It displays a web page on the client that runs code on the server
that selects and activates the device and displays that it is active.
If I put the etLine.CallDial line there it will even use the device
(even a voicemodem) attached to that server and dial the number. But
when I try to use the button on the form to tell the server to dial
the number, I can't figure out how to do it. Thanks.

Fred
Jul 19 '05 #4
Bob,

I wonder if option 1 would work. Which option would you learn more
about based on my description? I'm wondering if I try option 1 if I
could have the client page call the ASP page right away, since it
would have to run immediately and be waiting for their call. Then
when the call triggers the OnCallerID event, I send the callerID info
to the client page (and refresh if that is what I have to do). Then
the button un-grays to allow the number the ASP page already has (and
was displayed on the client page) to dial. I'm happy to spend the
weekend reading if you can just help with a little more direction. I
hope events are the same as in VB and VBScript. Thanks again.

Fred
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael SL | last post by:
Here is my problem. I have a delete record button. I want to prompt the user "Do you really want to delete?". If the user clicks 'OK' then I want to execute the CodeBehind on the server side to...
8
by: Shimon Sim | last post by:
Hi, Every time I write ASP.NET application I have the same problem - Back button on the browser is my enemy. I have to tell client avoid using "Back" button and if you use it make sure to refresh...
3
by: Penny Bond | last post by:
Hi, Any help or suggestions on this one would be gratefully appreciated: I have 2 aspx pages one is called 'Query' and the other 'Details'. Query page has a number of text boxes and drop...
13
by: James Bond | last post by:
Hello. My 80+ year old father has recently decided to get his first computer. Due to his age (and I suspect lack of playing pong as a child like I did) he lacks the manual dexterity to use a mouse...
7
by: Microsoft | last post by:
I'm not sure where to physically place my subroutines in vb.net I get namespace and not declared errors... Imports System Imports System.Management Public Class Form1
1
by: Mossman | last post by:
Hello, I will discuss at a high level what is happening on an ASP.NET web page I developed a year ago in ASP.NET using Visual Studio 2003 and currently support. I have an ASP.NET web page...
2
by: Michael | last post by:
Hi I've got a little issue with a form I'm working on right now. I have several command buttons on my web form and when I click on several of them, I get no response at all. I have defined events...
1
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
0
by: PointyPointy | last post by:
Hey, I'm hoping some can help me out with a small problem I'm having. I've got two frames - Frame1 and Frame2. Both have aspx pages (Primarily VB) loaded in them but to keep this explination...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.