thomas73
asked on
VBScript and CGI?
Here is a code fragment of a CGI script written in Visual Basic.
I'm trying to use HTML controls and embedded VBScript to combine the data
(integer) entered into a text box by the user with a choice (string) that
user has selected from a list box and place it into a second text box.
So far I've had no luck getting this to work.
The error message is: Object required "Accounts"
Perhaps a better question is: Can you use embedded VBS in a CGI script?
Send ("<INPUT TYPE= ""Text"" NAME=""Balance"" SIZE=""30"">")
Send ("<SELECT NAME=""Accounts"" SIZE=""8"">")
Send ("<INPUT TYPE= ""Text"" NAME=""Total"" SIZE=""45"">")
Send ("<INPUT TYPE=""Button"" NAME=""BTN"" VALUE=""Enter"">")
Send ("<Script Language=VBScript>")
Send ("Sub BTN_OnClick")
Send ("Total.Value = Accounts.Value & Balance.Value")
Send ("End Sub")
Send ("</Script>")
Thanks
Tom
I'm trying to use HTML controls and embedded VBScript to combine the data
(integer) entered into a text box by the user with a choice (string) that
user has selected from a list box and place it into a second text box.
So far I've had no luck getting this to work.
The error message is: Object required "Accounts"
Perhaps a better question is: Can you use embedded VBS in a CGI script?
Send ("<INPUT TYPE= ""Text"" NAME=""Balance"" SIZE=""30"">")
Send ("<SELECT NAME=""Accounts"" SIZE=""8"">")
Send ("<INPUT TYPE= ""Text"" NAME=""Total"" SIZE=""45"">")
Send ("<INPUT TYPE=""Button"" NAME=""BTN"" VALUE=""Enter"">")
Send ("<Script Language=VBScript>")
Send ("Sub BTN_OnClick")
Send ("Total.Value = Accounts.Value & Balance.Value")
Send ("End Sub")
Send ("</Script>")
Thanks
Tom
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ah. It becomes clear.
The SELECT object does not have a value. It does have a 'selectedIndex' however. In Javascript to get the value of a SELECT object you would use the following:-
Accounts.options[Accounts. options.se lectedInde x].value
I don't have the details for VBScript but I expect it will be very similar (if not identical).
The SELECT object does not have a value. It does have a 'selectedIndex' however. In Javascript to get the value of a SELECT object you would use the following:-
Accounts.options[Accounts.
I don't have the details for VBScript but I expect it will be very similar (if not identical).
ASKER
In my original posting. I did not make it clear that I had included the "Option Value" statements
in the <SELECT> tag. For example:
<SELECT NAME="Accounts">
<OPTION VALUE="Individual Retirement Account">Individual Retirement Account
<OPTION VALUE="Qualified Retirement Plan">Qualified Retirement Plan
<OPTION VALUE="Individual">Individ
</SELECT>
I just wanted to clear this up and not have you waste your time considering a potential problem that did not exist.
I did as you suggested and removed the CGI 'SEND' statements from the HTML in order to isolate the problem. To narrow the possibilities further, I removed the reference to the "Accounts" Object (the List box) in the VBS Sub procedure, leaving the procedure to read; (Total.Value=Balance.Value
Progress!
However, If the Sub procedure is written to include the "Accounts" Object and concatenate the values from the "Balance" text box and the "Accounts" List box; (Total.Value=Accounts.Valu
This is were the problem seems to lie. Which attribute of the <SELECT> tag holds the users selection, NAME or VALUE? I have two books on VBScript and HTML that give me two different answers.
I guess you're the tie breaker.
Thanks
Tom