06-23-04, 10:32 #1Registered User
- Join Date
- Feb 2004
Unanswered: ASP form, multiple items select If statement?
I used the DBW to create the database editor page. the one field i made is text with a drop down, for multiple selections.i got everything working except for the the edit page on the database editor page. heres an example of some of the code on the page (that way i can explain better with what i want to do)...
<option <% if "Jim" = FP_Field(fp_rs,"Employee") then %> selected <% end if %>>Jim</option>
<option <% if "Ken" = FP_Field(fp_rs,"Employee") then %> selected <% end if %>>Ken</option>
the above code is just 2 of the 9 users that work on projects, what i can do is select multiple at anytime, but when i go to edit a certain record it wont bring up any names unless i put in OR statements, but after looking at the total number of combinations that i would have, i hope there is a way that is much shorter.
so what i am asking is: is there a way to search that particular field using the 1 of the above if statements that if it sees Jim in any combination with other names that it selects Jim on the drop down lists automatically?
06-23-04, 11:41 #2Useless...
- Join Date
- Jul 2003
Well, if your array was a single dimension, you could use the Join() function, but that doesn't look like that will work for you. You'll probably have to make a function to check the array:
<% Function checkArrayForEmpl(aPeople, sPerson) Dim iCounter checkArrayForEmpl = False If IsArray(aPeople) Then For iCounter = 0 To UBound(aPeople)-1 If aPeople(iCounter,"Employee") = sPerson Then checkArrayForEmpl = True Exit For End If Next End If End Function %> <option <% if checkArrayForEmpl(FP_Field, "Jim") then %> selected <% end if %>>Jim</option> <option <% if checkArrayForEmpl(FP_Field, "Ken") then %> selected <% end if %>>Ken</option>That which does not kill me postpones the inevitable.