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 Subs When Select from Dropdown List

Status
Not open for further replies.

JohnBates

MIS
Feb 27, 2000
1,995
US
hi ASP people,

I have a workaround for this problem.. but I would rather do it the right way.

The page displays a droplist of phone extensions.
The problem is that 2 subs (Selectdata(ext) and DisplayTable) are being called as the page initially loads for the first time.

**************************
What I want is to only call these subs when the user selects an extension number from the listbox....this way,
the listbox would be the only thing appearing on the page until the user made a selection from it.
***************************

This is what I'm doing: The form name is Ext - when an extenson is selected, it submits the form (I guess ?)
<SELECT NAME=&quot;EXT&quot; size=&quot;1&quot; onChange=&quot;Ext.submit()&quot;>
<option>Select an Extension #</option>

I know this should be easy... I'm still learning
Thanks, John

 
in order to call a sub as you want you need to submit the form in some way. more then likely in this case by onChange or onSelect. ASP will only be performed when the page is loaded due to it being server side and no intervention with the browser in a sense during run time. in other wortds no real time functionality. as you have it is the right way. just call the script (sub) that you want on the basis of the selection A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
further my reply

what you can do is have a javascript function or actually two that will submit to a certain processing page. call those functions on the selection.
kind of like
function goHere() {
if (Ext.options[Ext.selectedIndex].value == &quot;555&quot;) {
form1.action = &quot;sub1.asp&quot;
form1.submit()
}
if (Ext.options[Ext.selectedIndex].value == &quot;333&quot;) {
form1.action = &quot;sub2.asp&quot;
form1.submit()
}
}

<SELECT NAME=&quot;EXT&quot; size=&quot;1&quot; onChange=&quot;goHere()&quot;>
<option>Select an Extension #</option>
<option value=&quot;555&quot;>555</option>
<option value=&quot;333&quot;>333</option>
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