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

Selected Value for drop down, Help Please....

Status
Not open for further replies.

SuperCyber

Programmer
Aug 10, 2001
35
US
I am beating my haed against the wall ive tried everything i can think of and still i cant grab the value of this dropdown. Any help is greatly appreciated.

Brian

varID = document.form.PHY_1.options(document.form.PHY_1.options.selectedIndex).value
 
sorry after looking at my post i felt i needed to be a little more specific, I am using a javascript onClick command to issue the new request each time the value changes. Then I am running asp code inside the javascript code to pull the value of the selected dropdown item and then pass it to my SQL SP. Then once I get the return values I pass them back to the javascript to populate span tags. It all works if i manually input a value for varID, but then what would be the point. If I could find a way to call the SQL SP from javascript or pass the value to VBScript from Javascript, then this would be a non issue. Below is the error i am receiveing and the code sniplet.

Thanks for your help,
Brian


I get this error when calling from VBscript:

Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/APS-Online/Customer/aaa.asp, line 17, column 45
varID = document.ClientErrCheck.PHY_1.options[document.ClientErrCheck.PHY_1.selectedIndex].value
--------------------------------------------^


Code snip:


<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--

function PHY_1_onchange() {

if (!(document.ClientErrCheck.PHY_1.selectedIndex == &quot;&quot;)){

<%
Dim varID, strAddress

varID = document.ClientErrCheck.PHY_1.options[document.ClientErrCheck.PHY_1.selectedIndex].value

&quot;....SQL stored procedure.....
Set prm1 = cmdGetCust.CreateParameter(&quot;@ID&quot;,adInteger,adParamInput,,varID)
cmdGetCust.Parameters.Append prm1
Set prm5 = cmdGetCust.CreateParameter(&quot;@Address&quot;,adVarChar,adParamOutput,50,strAddress)
cmdGetCust.Parameters.Append prm5
&quot;

Response.write &quot;var varAddress = &quot; & chr(34) & strAddress & chr(34) & &quot;;&quot;
%>

window.ADD_1.innerText = varAddress

}
}

//-->
</SCRIPT>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top