User:Edit function - drop down fields?
Posted: 25 January 2009 02:36 PM   [ Ignore ]
Jr. Member
RankRank
Total Posts:  42
Joined  2007-09-15

I have a State field in my custom member fields and am using user:edit.  Am I missing something in the docs that shows me how to create a dropdown field with the values, and select the user’s current choice, in the form?

Profile
 
 
Posted: 26 January 2009 08:01 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8266
Joined  2006-10-18

Hi Chad,

Yes, you are missing something from the Docs LOL
http://www.solspace.com/docs/entry/user_edit_profile/#select_your_custom_field

<select name="state">
{select_state}
<option value="{value}">{value}</option>
{/select_state}
</select
 Signature 
Profile
 
 
Posted: 26 January 2009 09:23 AM   [ Ignore ]   [ # 2 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2007-09-15

Ugh I’m such a dolt!  So I implemented that and its working fine - should it natively be able to select the current value if used in an update form?  Its not doing so for me.  Example:  My custom member field called State is set to California.  Using the code above, when I create a custom edit profile form, California is not selected when the form is loaded.

Thanks as always Pie Man

Profile
 
 
Posted: 27 January 2009 09:33 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8266
Joined  2006-10-18

Chad,

What type of field did you set your field as? A “Select” type? smile

 Signature 
Profile
 
 
Posted: 27 January 2009 10:03 AM   [ Ignore ]   [ # 4 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2007-09-15

It is set as a drop-down list in the CP.  I still don’t see any way to have user:edit show the correct choice on an update form.  Is there anything in particular I need to do?

Here is my code:

<div class="form-field">
    <
label for="cf_member_state">State</label>
    <
select name="cf_member_state" class="drop">
    
{select_cf_member_state}
    
<option value="{value}">{value}</option>
    
{/select_cf_member_state}
    
</select>
</
div

It is not selecting the correct value.

Profile
 
 
Posted: 27 January 2009 07:04 PM   [ Ignore ]   [ # 5 ]
Newbie
Avatar
Rank
Total Posts:  20
Joined  2008-09-19

Chad,

I’m having a similar problem. I’ve got the form working correctly, but each time I go back to the page with the state drop down, it defaults to the first option. I’m trying to figure out how to get the form to “remember” the user’s selected state.

Eric

 Signature 

Indie Arsenal | indiearsenal.com
+++++++++++++++++++++++++++++++++
Creative collaboration.
Professional development.
Targeted networking.

Profile
 
 
Posted: 28 January 2009 09:04 AM   [ Ignore ]   [ # 6 ]
Administrator
Avatar
RankRankRankRankRank
Total Posts:  8266
Joined  2006-10-18

Awe shoot…

I did not include the {selected} variable in my example smile

<div class="form-field">
    <
label for="cf_member_state">State</label>
    <
select name="cf_member_state" class="drop">
    
{select_cf_member_state}
    
<option value="{value}" {selected}>{value}</option>
    
{/select_cf_member_state}
    
</select>
</
div
 Signature 
Profile
 
 
Posted: 28 January 2009 09:39 AM   [ Ignore ]   [ # 7 ]
Jr. Member
RankRank
Total Posts:  42
Joined  2007-09-15

Perfect thanks!

Profile
 
 
Posted: 28 January 2009 02:21 PM   [ Ignore ]   [ # 8 ]
Newbie
Avatar
Rank
Total Posts:  20
Joined  2008-09-19

Yes, thanks Pie Man! Works perfectly.

 Signature 

Indie Arsenal | indiearsenal.com
+++++++++++++++++++++++++++++++++
Creative collaboration.
Professional development.
Targeted networking.

Profile
 
 
Posted: 26 June 2009 10:42 AM   [ Ignore ]   [ # 9 ]
Jr. Member
RankRank
Total Posts:  91
Joined  2007-04-27

I must be retarded or something but I have similar code and when a user goes to edit their profile the state drop down menu doesn’t stick to what was previously selected.

<select name="profile_addstate">
{select_profile_addstate}
<option value="{value}" {selected}>{value}</option>
{/select_profile_addstate}
</select

Help? grin

 Signature 

420 Creative: Web design + development, Portland, OR
EE Pro Network Member

Profile
 
 
Posted: 26 June 2009 10:47 AM   [ Ignore ]   [ # 10 ]
Jr. Member
RankRank
Total Posts:  91
Joined  2007-04-27

Never mind - just got it to work - formatting in the custom field was causing issues.

 Signature 

420 Creative: Web design + development, Portland, OR
EE Pro Network Member

Profile