Mark,
Just be careful with the contains operator. It performs differently with strings than it does with arrays. The expression item5 will match with "contains item55" if contains is used with a string. It does not match if the contains is used with an array.
<@assign request$itemList <@tokenize value="item1,item2,item55" chars=",">>
Array: <@if expr="@@request$itemList contains item5" true="True"><br>
<@assign request$itemList "item1,item2,item55">
String: <@if expr="@@request$itemList contains 'item5' " true="True"><br>
As contains also works on strings make sure that you use delimiters in the search.
<@assign request$itemList ",item1,item2,item55,">
String+delimiter: <@if expr="@@request$itemList contains ',item5,'" true="True">
Witango Support
On 02/03/2005, at 2:51 PM, David Shelley wrote:
Mark,
Here’s a snippet that might help:
<@assign request$itemList <@tokenize value="item1,item2,item5" chars=",">>
<select name=item size=6 multiple>
<option value="item1" <@if expr="@@request$itemList contains item1" true="selected">>item1</option>
<option value="item2" <@if expr="@@request$itemList contains item2" true="selected">>item2</option>
<option value="item3" <@if expr="@@request$itemList contains item3" true="selected">>item3</option>
<option value="item4" <@if expr="@@request$itemList contains item4" true="selected">>item4</option>
<option value="item5" <@if expr="@@request$itemList contains item5" true="selected">>item5</option>
<option value="item6" <@if expr="@@request$itemList contains item6" true="selected">>item6</option>
</select>
Dave Shelley
-----Original Message----- From: Mark Weiss [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 01, 2005 7:29 PM To: [email protected] Subject: Witango-Talk: Is this possible?
Is this possible?
I have a multiple Select list
<select Name="ssss" size="6" multiple> <@rows> <option value-"" HERE >alskjsdlfj</option> </@rows> </select>
I select three items out of 6 in the list and save it to the db like
item1,item2,Item3
Then when I bring it back to display in detail
As it loops through each row returned, I want to check to see if the option value = any of the values (item1, item2, item3) and if so, add "Selected" to the option item so that the 3 items show up as selected in detail.
I know the <@if expr=""></@if> format for multiple "OR" options in the expr statement, but I can seem to get the format done right from the column being returned.
Does anyone have some sample code that might get me further down the road?
I can convert the returned data using <@tokenize> and make an array, but that is as far as I get.
Thanks so much in advance.
Mark
_______________________________________________________________________ _
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
_______________________________________________________________________ _
TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/developer/maillist.taf
