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

     <select name="company_state">
                <option value="{value}" {selected}>{value}</option>
     <p><input type="submit" value="Submit" /></p>

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.


Your Answer

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

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