Hi,
in a normal HTML page when you create a select list where the value attribute is not defined of option tags then the text is served as values. see example below…
<select>
[indent]<option>value 1</option>[/indent]
[indent]<option>value 2</option>[/indent]
[indent]<option>value 3</option>[/indent]
</select>
I want to achieve same thing in
CHtml::dropDownList()
method. I am providing this array
array('1 week', '2 weeks', '1 month', '3 months', '6 months', '1 year')
in the data parameter of the method. The resulting HTML is this
<select name="recent" id="recent">
<option value="">-select-</option>
<option value="0">1 week</option>
<option value="1">2 weeks</option>
<option value="2">1 month</option>
<option value="3">3 months</option>
<option value="4">6 months</option>
<option value="5">1 year</option>
</select>
How to avoid array keys to appear in the values. I know we can specify the keys explicitly same as the text but then the array grows with redundant text. Thats how it looks to me.
Any suggestions?
Thank you.