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

Passing args to Function - how to do in VBScript?

Status
Not open for further replies.

JLONON

Programmer
Mar 10, 2003
6
US
I am attempting to pass arguments (only one till I get this working) to a VBScript function. This function is for my SELECT tag and the onChange event. The text value I want to pass is NOT from the form, but from the .ASP itself. I need this value inside my scripted function for some conditional testing.

The code is simple: When user selects from the list, set the next field automatically to the appropriate value! I have tested the code without the arg (by setting a Dimensioned var manually inside the function and it works.

However, when I truly test my code, I get the text &quot;[object]&quot; in the field that I am trying to auto-set. I have searched and searched and have not found a solid example of how to properly pass args from a select tags onchange=&quot;someFunc(<%=arg%>)&quot; or what [object] is trying to tell me.

If I view the source code, I can see the correct value in the arg position, but the other field always gets populated with [object]. Not sure what I need to do.

I'm trying with this question before sending code to see if the answer is closer than I think. If necessary I'll paste some code in. Thanks in advance, Jonathan.
 
If onchange=&quot;someFunc(<%=arg%>)&quot; is the part your &quot;ASP&quot; page is writing out then try:

onchange=&quot;someFunc('<%=arg%>')&quot;

If <%=arg%> is in a vbscript function on the clientside then it will not work.

Without your code post though, it is hard to really answer this question. &quot;did you just say Minkey?, yes that's what I said.&quot;

MrGreed
 
Thanks! That worked. The problem was that I was not using single quotes around the passed value (i.e., '<%=arg%>') for the passed arg! I had double quotes!

Thanks again!
Jonathan.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top