Country Drop-down lists, how do you go about that?
Posted: 12 January 2008 07:13 AM   [ Ignore ]
Member
RankRankRank
Total Posts:  55
Joined  2007-12-15

Just out of dire curiosity, a select-country drop down list isn’t that straight forward as imagined.

When creating a drop-down field in the CP Custom member field section, you can enter the names of the countries but not the option values. So ultimately, I have two separate country lists. One in the CP section and one custom list with an embedded country list template.

Have any of come across this? I suspect a list of countries is not that uncommon! grin

Profile
 
 
Posted: 12 January 2008 07:23 AM   [ Ignore ]   [ # 1 ]
Member
RankRankRank
Total Posts:  55
Joined  2007-12-15

I guess the question here is how to get the values of a list from a drop-down custom member field. hmmm

Profile
 
 
Posted: 12 January 2008 08:16 AM   [ Ignore ]   [ # 2 ]
Member
RankRankRank
Total Posts:  55
Joined  2007-12-15

The EE manual suggests the code below in a SAEF:

<select id=“{field_name}“ name=“{field_name}“>
{options}<option value=“{option_value}“{selected}>{option_name}</option>{/options}
</select>

But that doesn’t seem to work with custom member fields.

Profile
 
 
Posted: 12 January 2008 08:42 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3717
Joined  2006-10-18

Any chance a bit of hard-coding would work? smile

I’m assuming your desired output would be something like:


<select id="fieldname" name="fieldname">
<
option value="US"{selected}>United States</option>
<
option value="CA"{selected}>Canada</option>
etc
</select>

 Signature 

Check out the new Solspace Blog!

Profile
 
 
Posted: 12 January 2008 09:33 AM   [ Ignore ]   [ # 4 ]
Member
RankRankRank
Total Posts:  55
Joined  2007-12-15

Yeah, hard-coding certainly works.

But here’s what that translates into: I had to create a separate list with all countries and embed it. So within the {exp:user:edit} tags, I have the following code:

<select name='country'>
<
option value="">Select</option>
{embed="lists/countries"}
</select>

But that means that I have two separate lists, one as a drop-down custom member field in the CP section and another one that is hard-coded as described above.
I suppose it’d be really elegant if I could pull the options of a custom member field to populate my pull-down within the {exp:user:edit}.

Just an idea to complement the exp:user:edit functionality.

Profile
 
 
Posted: 12 January 2008 09:50 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3717
Joined  2006-10-18

Yes but aren’t you trying to get two different sets of values?
1 - a Value… perhaps being an abreviation
and
2 - a “Friendly” name for those values

You can’t currrently do that with Native EE member templates…

 Signature 

Check out the new Solspace Blog!

Profile
 
 
Posted: 12 January 2008 09:57 AM   [ Ignore ]   [ # 6 ]
Member
RankRankRank
Total Posts:  55
Joined  2007-12-15

Yeah. Argh. Happy days.

Profile
 
 
Posted: 12 January 2008 09:58 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3717
Joined  2006-10-18

Haha, Sorry man wink

 Signature 

Check out the new Solspace Blog!

Profile
 
 
Posted: 12 January 2008 10:01 AM   [ Ignore ]   [ # 8 ]
Member
RankRankRank
Total Posts:  55
Joined  2007-12-15

Np! In fact, I think it’s amazing how much further I could venture with the User module.

The only other thing is to get user lists sorted by entries and or be able to show the number of contributions by users. wink
http://www.solspace.com/forums/viewthread/525/

Profile