Categories > TinyButStrong general >

option values selected

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: lui10e6
Date: 2010-08-23
Time: 17:24

option values selected

i want to display a block of option dropdown lists that hold a value of date from database.
When empty it is like this:
<select  name="[onshow.test.test.fieldName]_[testBlock.name]" class="date [testBlock.name;block=li;sub1=values]"><option>[testBlock_sub1.val;block=option]</option></select>

and after retrieving a value it should be like option selected, like
<option value="[xxxxxxxxxxx]" selected>[testBlock_sub1.val;block=option]</option>       

how do i make a selected option with tbs?
By: kle_py
Date: 2010-08-23
Time: 17:52

Re: option values selected

Hi lui10e6

I use something like:
<option value="[testBlock_sub1.$;block=option;]"[blk1.db_field;if [val]=[testBlock_sub1.$];then ' SELECTED';else '';]>[testBlock_sub1.val]</option>
and it does the job for me :) .