Hi there,
You can simply save the values you want to Session variables, and later use them again:
Code:
If item1 = "checkbox" Then
Session("CheckBox1") = True
End If
Later in your form, you can use this code to preselect the item again:
Code:
Dim CheckedString
If Session("CheckBox1") = True Then
CheckedString = " checked=""checked"""
End If
...
<form>
<input name="checkbox" type="checkbox" value="checkbox"<%=CheckedString%> />
</form>
When the page is loaded, CheckedString will get a value if the Session value equals True. The value of " checked=""checked"" for the CheckedString variable will end up in the checkbox like this:
<input name="checkbox" type="checkbox" value="checkbox" checked="checked" />
causing the checkbox to be selected.
The example I gave is quite verbose, to demonstrate the concept. In reality, you can compact the code a bit by saving the checked="checked" string as the Session variable's value or by using Response.Write to write out the checkbox inside the If statement.
All solutions would work equally well, so it's just a matter of personal preference.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to:
3 Libras by
A Perfect Circle (Track 18 from the album:
Thirteenth Step)
What's This?