Profile Field Multi select
Posted: 13 September 2008 02:36 PM   [ Ignore ]
Member
RankRankRank
Total Posts:  67
Joined  2006-01-09

I am trying to pass multiple values to member profile field from edit profile.

<select multiple name="dog_breed" size="10">
   <
option value="Pug">Pug
 
<option value="spaniel">Spaniel
 
<option value="poodle">Poodle
 
<option value="Other">Other
  
</select>

Any way to do this? I tried textarea and text but only saves last selection…
thanks

Profile
 
 
Posted: 15 September 2008 08:41 AM   [ Ignore ]   [ # 1 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

You need to add [] to your code to allow Multiples smile

<select multiple name="dog_breed[]" size="10">
   <
option value="Pug">Pug
   
<option value="spaniel">Spaniel
   
<option value="poodle">Poodle
   
<option value="Other">Other
</select>

 Signature 
Profile
 
 
Posted: 15 September 2008 10:10 AM   [ Ignore ]   [ # 2 ]
Member
RankRankRank
Total Posts:  67
Joined  2006-01-09

Thanks! As usual, a genius smile
Now I’ll push my luck, in edit can it show seleted ones from profile?

Thanks

Profile
 
 
Posted: 15 September 2008 10:20 AM   [ Ignore ]   [ # 3 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Certainly wink

This should work: smile

<select name="dog_breed[]" multiple="multiple" size="10">
   
{select_dog_breed}
   
<option value="{value}" {selected}>{value}</option>
   
{/select_dog_breed}
</select>

 Signature 
Profile
 
 
Posted: 15 September 2008 10:32 AM   [ Ignore ]   [ # 4 ]
Member
RankRankRank
Total Posts:  67
Joined  2006-01-09

hmmm that didn’t work,

I have a textarea in profile custom fields, should it be a dropdown? The first solution worked for putting the multiple values into profile field,
If dropdown will that work fror multiple?

Profile
 
 
Posted: 15 September 2008 10:35 AM   [ Ignore ]   [ # 5 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18
Bruce - 15 September 2008 10:32 AM

I have a textarea in profile custom fields, should it be a dropdown?

Yes wink

Bruce - 15 September 2008 10:32 AM

If dropdown will that work fror multiple?

I believe so wink

 Signature 
Profile
 
 
Posted: 15 September 2008 10:45 AM   [ Ignore ]   [ # 6 ]
Member
RankRankRank
Total Posts:  67
Joined  2006-01-09

Best to try before asking wink sorry.

Actually, it seems there is a choice. Using this seems to retain the multiple selections in edit form when using a dropdown in profile custom fields, and they show those selected on the edit page.
In profile, as it is a dropdown, of course shows one only, and if one updates from admin member profile it saves the one.
If using the tag in an entry dog_breed, it shows the ones selected as well.

So it’s workable and as likely as we can get it , right? Unless one could add a new field type in the code for the module?

thank you very much!

Profile
 
 
Posted: 15 September 2008 11:00 AM   [ Ignore ]   [ # 7 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Bruce…

Fortunately, it’s already been done wink

http://expressionengine.com/forums/viewthread/38370/

 Signature 
Profile
 
 
Posted: 15 September 2008 11:17 AM   [ Ignore ]   [ # 8 ]
Member
RankRankRank
Total Posts:  67
Joined  2006-01-09

That doesn’t seem to work with custom profile fields though?
I have it installed..

Profile
 
 
Posted: 15 September 2008 11:30 AM   [ Ignore ]   [ # 9 ]
Administrator
Avatar
RankRankRankRank
Total Posts:  3356
Joined  2006-10-18

Oh crap… what am I thinking…

Sorry… otherwise I’m not aware of any other solution.

 Signature 
Profile
 
 
Posted: 15 September 2008 11:38 AM   [ Ignore ]   [ # 10 ]
Member
RankRankRank
Total Posts:  67
Joined  2006-01-09

I have a great idea---feature request! lol
smile

Thanks for all the help, it is working now at least, and they can edit profile away from cp, but it would be nice to add that.

Profile