VBScript dynamic Select Case - TechRepublic
General discussion
April 4, 2001 at 09:06 AM
ladyskydiver

VBScript dynamic Select Case

by ladyskydiver . Updated 25 years, 2 months ago

I have a hidden field with a select case built into it. I need to run the select case from an onclick event in VBScript. Here’s an example:

DO UNTIL rs2.eof
If rs2(fieldname) = “ALL” then
str = str & “CASE ” & x & vbCrLF & “document.formname.fieldname” & x & “.” & y & “.1.checked = false” & vbCrLf
Else
stra = stra & “CASE ” & x & vbCrLf & “document.formname.fieldname” & x & “.” & y & “.1.checked = false” & vbCrLf
End If

onclick=”verify ‘trim(rs2(fieldname))’, <%=x%>“>

rs2.movenext
LOOP

later in the page:

>
>

end of page:

However, I need it to run only the appropriate select case items. The textbox str would have something like:

CASE 0
document.formname.fieldname0.1.1.checked = false
CASE 0
document.formname.fieldname0.2.1.checked = false
CASE 1
document.formname.fieldname1.1.1.checked = false
CASE 1
document.formname.fieldname1.1.1.checked = false
…etc.

How would I get the VBScript sub to execute only those items in Case 0? or Case 1? etc???

Your help is GREATLY appreciated. Thank you!

Regards,
Cora

This discussion is locked

All Comments