Hello,
I have a dropdown list box on an ASP page that is supposed to have three items: None, Approved, Disapproved.
So the user needs to select one of the above and saves the form. Then when he visits the page, his selection should reflect on the page again. I am using the following code but it doesnt seem to work:
function SetCboSelected(OptionsTxt, SelectedValue)
Dim sFind, pos, LineStart, re
if len(SelectedValue) = 0 then
SetCboSelected = OptionsTxt
exit function
end if
set re = new RegExp
re.IgnoreCase = true
re.Multiline = true
re.Global = false
re.Pattern = "(<option value=)([\""']?" & SelectedValue & "[\""'])"
SetCboSelected = re.Replace(OptionsTxt, "$1$2 Selected class=""optSelected""")
end function
<th><select id="ApprovalIndicator" style="width:220px" name="ApprovalIndicator" onchange="document.body.focus();">
<%dim optApprovalIndicator
optApprovalIndicator = "<option value=""B""> </option>"
optApprovalIndicator = optApprovalIndicator & "<option value=""A"">Approved</option>"
optApprovalIndicator = optApprovalIndicator & "<option value=""D"">Disapproved</option>"
Response.Write(SetCboSelected(optApprovalIndicator,RS1("APPROVALINDICATOR")))
%>
</select></th>
So basically, I am using regular expressions to match what the user selected and saved in the DB so thats what the form displays.
Thanks.
I have a dropdown list box on an ASP page that is supposed to have three items: None, Approved, Disapproved.
So the user needs to select one of the above and saves the form. Then when he visits the page, his selection should reflect on the page again. I am using the following code but it doesnt seem to work:
function SetCboSelected(OptionsTxt, SelectedValue)
Dim sFind, pos, LineStart, re
if len(SelectedValue) = 0 then
SetCboSelected = OptionsTxt
exit function
end if
set re = new RegExp
re.IgnoreCase = true
re.Multiline = true
re.Global = false
re.Pattern = "(<option value=)([\""']?" & SelectedValue & "[\""'])"
SetCboSelected = re.Replace(OptionsTxt, "$1$2 Selected class=""optSelected""")
end function
<th><select id="ApprovalIndicator" style="width:220px" name="ApprovalIndicator" onchange="document.body.focus();">
<%dim optApprovalIndicator
optApprovalIndicator = "<option value=""B""> </option>"
optApprovalIndicator = optApprovalIndicator & "<option value=""A"">Approved</option>"
optApprovalIndicator = optApprovalIndicator & "<option value=""D"">Disapproved</option>"
Response.Write(SetCboSelected(optApprovalIndicator,RS1("APPROVALINDICATOR")))
%>
</select></th>
So basically, I am using regular expressions to match what the user selected and saved in the DB so thats what the form displays.
Thanks.