S
skeddy
In a nutshell, I'm trying to dynamically create a select box with
ResultSet code in vbscript and then need to be able to access the value
of that select box later with a Save button.
I've got the select box filling with code similar to below:
<SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
Public Sub BuildComboBox(rs, dispname, val, name, selected)
'rs = the recordset
'val = fieldname to place in the val of the option
'dispname = fieldname to display in the user control
'name = name of the select (cboBox)
'selected is the item in the lst that should be selected
rs.movefirst
response.write("<SELECT NAME=" & name & ">")
while not rs.eof
if rs.fields(val) = selected then
response.write("<OPTION VALUE=" & rs.fields(val) & " selected>")
response.write(rs.fields(dispname) & "</OPTION>")
else
response.write("<OPTION VALUE=" & rs.fields(val) & ">")
response.write(rs.fields(dispname) & "</OPTION>")
end if
rs.MoveNext
wend
response.write("</SELECT>")
End Sub
</SCRIPT>
Peachy. Now I need to get to the user-selected value of that box when
they hit the Save button. My issue with vbscript thus far is that
it'll create me a select box dynamically in the runat=server code (as
above). But another function in that same vbscript section can't find
my select box. It seems to only recognize it if I statically create it
in html, not in vbscript. Oh, and I'm using something like this in the
vbscript to get the select box's value: "dept =
DepartmentsSelectBox.Value"
Help? I've been cursing vbscript all day, and I'm sure my co-workers
are tired of my whining.
Mucho Thanks,
sara
ResultSet code in vbscript and then need to be able to access the value
of that select box later with a Save button.
I've got the select box filling with code similar to below:
<SCRIPT LANGUAGE=VBSCRIPT RUNAT=SERVER>
Public Sub BuildComboBox(rs, dispname, val, name, selected)
'rs = the recordset
'val = fieldname to place in the val of the option
'dispname = fieldname to display in the user control
'name = name of the select (cboBox)
'selected is the item in the lst that should be selected
rs.movefirst
response.write("<SELECT NAME=" & name & ">")
while not rs.eof
if rs.fields(val) = selected then
response.write("<OPTION VALUE=" & rs.fields(val) & " selected>")
response.write(rs.fields(dispname) & "</OPTION>")
else
response.write("<OPTION VALUE=" & rs.fields(val) & ">")
response.write(rs.fields(dispname) & "</OPTION>")
end if
rs.MoveNext
wend
response.write("</SELECT>")
End Sub
</SCRIPT>
Peachy. Now I need to get to the user-selected value of that box when
they hit the Save button. My issue with vbscript thus far is that
it'll create me a select box dynamically in the runat=server code (as
above). But another function in that same vbscript section can't find
my select box. It seems to only recognize it if I statically create it
in html, not in vbscript. Oh, and I'm using something like this in the
vbscript to get the select box's value: "dept =
DepartmentsSelectBox.Value"
Help? I've been cursing vbscript all day, and I'm sure my co-workers
are tired of my whining.
Mucho Thanks,
sara