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

Can't pass 2 parameters to vbs function from Onclick

Status
Not open for further replies.

kev05

MIS
Mar 15, 2005
32
GB
Hi,

I have an html file with a vbscript function.

I have a form in which i send the value to my vbs function.

In the below form, I'm passing 1 parameter and it does work:

function Runtest(iteration)
...
....
End function


<FORM name ="Input">

Please enter your iteration: <INPUT name=iteration><BR>
INPUT onclick="RunTest iteration.value" type=submit value=LaunchQTP name=RunTest>

</FORM>

- RunTest is the name of the function
- iteration is the name of parameter

Now I want to have another input field and want to pass more than 1 parameter to my vbs function- Any ideas how to do that?


thanks in advance,
Kev
 
>[tt]onclick="RunTest iteration.value"[/tt]
>Now I want to have another input field and want to pass more than 1 parameter to my vbs function

Simply comma separate them.
[tt]onclick="RunTest iteration.value[blue],arg2[/blue]"[/tt]
and the function should set up with two arguments accordingly, of course.

But, your problem is mostly html page design. The practice of your html tagging and naming are very much lack of imagination and against the rules.

[1] Do not cluster the names around the same word. With you naming, it even does not work with one argument! I guess (and you tell us it works for one argument).
[2] You put onclick handler on submit type input field. You would have big trouble to get it working.

Hence, I would advise you do this.
[tt]<INPUT onclick="RunTest iteration.value" type=[red]button[/red] value=LaunchQTP name=[red]anynameotherthanRunTest[/red]>[/tt]
Then in your function, if you really mean submit, add the submit line there.
[tt] 'if everything works correctly and ready to submit
[blue]document.input.submit[/blue][/tt]

You form is named "input", again not a very judicious choice to name a form! despite it being acceptable. Furthermore, you leave the attribute unquoted. This is old-school and you can anticipate trouble ahead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top