Why wouldn't a...

1. Senior Member
Join Date
Dec 1969
Posts
2,049

Why wouldn't a...

text value work??<BR><BR>Here is the function<BR><BR><BR>&#060;select name="select"&#062;<BR>&#060;%<BR>Subjects = "&#060;OPTION VALUE=&#039;abc&#039;&#062;One&#060;/option&#062;&#060;OPTION VALUE=&#039;defghi&#039;&#062;two&#060;/option&#062;&#060;OPTION VALUE=&#039;jjj&#039;&#062;three&#060;/option&#062;"<BR><BR>Call GetSelected(Subjects, "jjj")<BR><BR>Function GetSelected(PD,Selected)<BR>Dim items<BR>items = Split(PD,"&#062;")<BR><BR>Dim obj<BR>Dim v &#039;value<BR>Dim L &#039;Length<BR><BR>For i = 0 To UBound(items) Step 2<BR>L = Len(items(i))<BR> If L &#062; 2 Then<BR> If Mid(items(i),L - 1,1) = Selected Then<BR> Response.Write items(i) &" selected&#062;"& items(i+1) &"&#062;"& VBnewline<BR> Else<BR> Response.Write items(i) &"&#062;"& items(i+1) &"&#062;"& VBnewline<BR> End if<BR> End If<BR>Next<BR><BR>End Function<BR>%&#062;<BR>&#060;/select&#062;<BR><BR>Numbers work great just not text.

2. Senior Member
Join Date
Dec 1969
Posts
96,118

I dunno, but easier way...

&#060;%<BR>Subjects = "&#060;OPTION VALUE=&#039;abc&#039;&#062;One&#060;/option&#062;&#060;OPTION VALUE=&#039;defghi&#039;&#062;two&#060;/option&#062;&#060;OPTION VALUE=&#039;jjj&#039;&#062;three&#060;/option&#062;"<BR><BR>Call GetSelected(Subjects, "jjj")<BR><BR>Function GetSelected(PD,Selected)<BR> Dim test<BR> test = "VALUE=&#039;" & Selected & "&#039;"<BR> GetSelected = Replace( PD, test, test & " SELECTED" )<BR>End Function<BR>%&#062;<BR><BR>If you want, you could use vbTextCompare with the Replace to make it case insensitive.<BR><BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
2,049

RE: I dunno, but easier way...

Did you already have that done or did you whip-it-up?<BR><BR>Sheesh...that took me a couple of hours.<BR><BR>I need to goto Bill&#039;s school of code cruching. ;-)<BR><BR>Thank you.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•