Forums / General / How do you write a <select> statement to write to a string field rather than using enum.

How do you write a <select> statement to write to a string field rather than using enum.

Author Message

Stuart Fenton

Wednesday 04 February 2004 5:45:06 am

{literal}

I don't want to use the enum field to enter data from a <select> statement. How can I do this?

I presume I do the following but I can&#8217;t find any documentation on it and it's hard to work out the correct syntax from the other <select> statements in the code.

<input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />

<select name="ContentObjectAttribute_id[]" >
<option value="Female">Female</option>
<option value="Male">Male</option>
</select>

Any help would be great.
Thanks
Fats.
{/literal}

--- Actually I figured it out (but I couldn't post a reply to my question so I adding it here)

----
Here is the correct code in case anyone needs it.

<select name="ContentObjectAttribute_ezstring_data_text_{$ContentObjectAttribute:item.id}" >
<option name="ContentObjectAttribute_ezstring_data_text_{$ContentObjectAttribute:item.id}"
value="Female"
{switch match=$ContentObjectAttribute:item.data_text}
{case match="Female"}selected{/case}{case}{/case}
{/switch}>
Female
</option>
<option name="ContentObjectAttribute_ezstring_data_text_{$ContentObjectAttribute:item.id}"
value="Male"
{switch match=$ContentObjectAttribute:item.data_text}
{case match="Male"}selected{/case}{case}{/case}
{/switch}
>Male
</option>
</select>

Fats.

-- Stuart

stuart@grandmore.com
http://www.grandmore.com