3

So, in a member profile, I have created a custom field for company_state as a select and its populated with the US States. I cannot for the life of me figure out how to render out a select with those options for selection in a frontend form (I am using Solspace User's user:edit if it matters.)

Anybody know how to do this? Would be much appreciated.

1 Answer 1

1
{exp:user:edit}  
     <select name="company_state">
            {select_company_state}
                <option value="{value}" {selected}>{value}</option>
            {/select_company_state}
      </select>
     <p><input type="submit" value="Submit" /></p>
{/exp:user:edit}

This variable pair is a flexible method for creating pull-down menus, radio button arrays, etc. In the variable pair, you precede the short_name of the member field with select_. Providing your member field is a Select field with multiple values, it will automatically generate those values for you. Within this variable pair, the following variables become available:

value - the values stored as options for the member field.
selected - parses to selected="selected" if the option is the current value for the users' profile.
option_index - behaves like a count variable and displays the display order of each value.

http://www.solspace.com/docs/user/edit/#select_custom_member_field

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.