NEW - Custom Drop Down Creator…
Posted: 21 May 2008 12:52 PM   [ Ignore ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006

Hiya,

Here’s another one for anyone that might be interested. This allows you to re-create a drop-down menu in a form if you have a custom field of type drop-down.

Instructions are fairly simple :

Version 1.0.1 - Added initial_value_value and initial_value_option parameters

<select id="{exp:custom_drop_down:field_id field_name="drop-down"}" name="{exp:custom_drop_down:field_id field_name="drop-down"}">

{exp:custom_drop_down field_name="drop-down" initial_value_value="my-value" initial_value_option="Choose an option&hellip;"}
<option value="{value}">{value}</option>
{/exp:custom_drop_down}

</select>

If you leave the initial_value_option=”” parameter blank then nothing will be output and you will just get your options without an initial one.


Version 1.0

<select id="{exp:custom_drop_down:field_id field_name="field_name_goes_here"}" name="{exp:custom_drop_down:field_id field_name="field_name_goes_here"}">

{exp:custom_drop_down field_name="field_name_goes_here"}
<option value="{value}">{value}</option>
{/exp:custom_drop_down}
</select>

Hope it helps.

Best wishes,

Mark

Disclaimer
I’m pretty sure this should just work as advertised but please don’t sue me if anything goes wrong wink

File Attachments
pi.custom_drop_down_1.0.1.php.zip  (File Size: 2KB - Downloads: 386)
pi.custom_drop_down_1.0.php.zip  (File Size: 2KB - Downloads: 209)
 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 17 September 2008 01:10 PM   [ Ignore ]   [ # 1 ]  
Summer Student
Avatar
Total Posts:  13
Joined  01-18-2008

thanks Mark - another doozazzling plugin - might come in handy if I ever figure out how to extend search so that you can pass through a value (eg. song_key) via a dropdown and that the field (eg. song_key) is searched for that value (as well as the usual keywords)

Profile
 
 
Posted: 17 September 2008 02:42 PM   [ Ignore ]   [ # 2 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006

Hi Glen,

Wow my first person who has seen this one!! wink

Didn’t think anyone would ever find it although looking at the file above seems it has been downloaded quite a lot! Weird! There must be a lot of silent users in here!!  wink

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 08 October 2008 12:33 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  173
Joined  08-25-2008

I’m using this too - it’s really useful, actually. Thank you Mark.

One weird thing that I’ve noticed, though: the dropdown on the front-end side has a blank line between every option value. Those HTML it produces looks like this:

<option value="---">---<option>

<
option value="Child Care">Child Care<option>

<
option value="Childs Play Center">Childs Play Center<option>

<
option value="Day Care & After Sch">Day Care & After Sch<option>

<
option value="Day Nsy/Kindergarten">Day Nsy/Kindergarten<option>

<
option value="Day Nursery Infants">Day Nursery Infants<option>

when it should, I think, look like this:

<option value="---">---<option>
<
option value="Child Care">Child Care<option>
<
option value="Childs Play Center">Childs Play Center<option>
<
option value="Day Care & After Sch">Day Care & After Sch<option>
<
option value="Day Nsy/Kindergarten">Day Nsy/Kindergarten<option>
<
option value="Day Nursery Infants">Day Nursery Infants<option>

Those extra lines are showing up on the frontend. Has anyone else had this problem? Have you worked around this, Mark?

 Signature 

lukemcreynolds.com | some useful ee code snippets and tricks

Profile
 
 
Posted: 08 October 2008 01:30 PM   [ Ignore ]   [ # 4 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006

Hi Luke,

Thanks for the comment on the plugin.

Have you tried this at all?

<select id="{exp:custom_drop_down:field_id field_name="drop-down"}" name="{exp:custom_drop_down:field_id field_name="drop-down"}">
{exp:custom_drop_down field_name="drop-down"}<option value="{value}">{value}</option>
{/exp:custom_drop_down}</select>

That should hopefully fix it up for you?

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 11 November 2008 08:04 AM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  5
Joined  11-09-2008

I’m having some problems when setting the “initial_value_option”.  I use this plugin in combination with the form helper to create a stand alone edit form were customers can edit their previously entered data.

When I use the following code to display the current value for my field “ploeg”,  the correct value is displayed in my page :
{exp:form_helper:field_parser}{ploeg}{/exp:form_helper:field_parser}

Now, when I use the same code to fill in the “inital_value_option” field, the resulting drop down field contains some gibberish value.

<select id=”{exp:custom_drop_down:field_id field_name="ploeg"}” name=”{exp:custom_drop_down:field_id field_name="ploeg"}”>

{exp:custom_drop_down field_name=“ploeg” initial_value_option=”{exp:form_helper:field_parser}{ploeg}{/exp:form_helper:field_parser}”}
<option value=”{value}”>{value}</option>
{/exp:custom_drop_down}
</select>

Is this is a bug or am I using this option in the wrong way ?

Profile
 
 
Posted: 14 January 2009 09:47 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  198
Joined  08-14-2007

Hi Mark

Does your plugin support output where more than one option is selected at a time? Like this:

<select id="field_id_18" name="field_id_18[]" multiple="true" size="6">
<
option value='Please select...'>Please select...</option>
<
option value='Teachers' selected='selected'>Teachers</option>
<
option value='Environmental educators' selected='selected'>Environmental educators</option>
<
option value='Play/youth leaders'>Play/youth leaders</option>
<
option value='Early years providers (4 years and under)'>Early years providers (4 years and under)</option>
<
option value='Young People'>Young People</option>
<
option value='Anyone'>Anyone</option>
</
select>

I’m looking for a way of showing multiple selections in a select field for a SAEF. Any suggestions?

cheers

Jim

 Signature 

Jim Pannell | Six Media Web Development | Copenhagen, Denmark
Twitter: @jimpannell

Profile
 
 
Posted: 14 January 2009 10:02 AM   [ Ignore ]   [ # 7 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006

Hi Jim,

If you mean to have the selections already made when outputting the list then no it doesn’t do that and I don’t actually see an easy way of doing that really as all that gets stored in a drop-down list custom field is the names of each option and not whether or not they are selected or not.

Really all my plugin does is finds the options and then spits each one out. To be able to make more than one selected automatically would mean it would need more information that unfortunately isn’t available to it.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 14 January 2009 10:07 AM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  198
Joined  08-14-2007

Thanks for your quick reply. No worries about your plugin not being able to do that. I’m sure I’ll find a use for it somewhere else grin.

I guess my search will continue…

Jim

 Signature 

Jim Pannell | Six Media Web Development | Copenhagen, Denmark
Twitter: @jimpannell

Profile
 
 
Posted: 14 January 2009 10:08 AM   [ Ignore ]   [ # 9 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006
SixMedia - 14 January 2009 10:07 AM

I guess my search will continue…

Jim

Sorry about that downer

Hope you find something that works for you.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 08 April 2009 05:11 AM   [ Ignore ]   [ # 10 ]  
Grad Student
Rank
Total Posts:  85
Joined  11-13-2008

Hello Mark et al.

I am just trying to create a Drop Down List in my user registration form populated from one of my custom profile fields. I am using a SAEF for member registration.

I have used your plugin and code: but my Drop Down list is showing nothing, not even the initial value ???

My code is here below. Is there something I am missing? My only guess is that it has something to do with being the Member Register form, or should that not mean anything ?? What I also need to ensure is that the selected value is then fed back to the database.

<select id="{exp:custom_drop_down:field_id field_name="position"}" name="{exp:custom_drop_down:field_id field_name="position"}" >
{exp:custom_drop_down field_name="position" initial_value_value="Undergraduate" initial_value_option="Choose an option&hellip;"}
<option value="{value}">{value}</option>
{/exp:custom_drop_down}
</select>

<
label for="position">Your Position</label>

Mark: I had a look in the php file and I noticed that the plugin makes the call from : exp_weblog_fields

Does this mean that it is because I am trying to get this to work in the Member Profile ?

If so, is there another nice plugin solution here ??? wink


Thank you any urgent assistance here grin

Alison

Profile
 
 
Posted: 08 April 2009 05:38 AM   [ Ignore ]   [ # 11 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006

Hi Alison,

Unfortunately the plugin was created for use with custom weblog fields only and not member profile fields. I’m not entirely certain that a plugin would work in your instance anyway as I don’t believe that the registration form will allow for plugins to be run inside of it. I might be wrong on that one but I know that those templates don’t allow as much to go on as normal weblog templates and so this is why I’ve never really looked at making anything for them I’m afraid.

Someone else might have an idea though hopefully.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 08 April 2009 05:49 AM   [ Ignore ]   [ # 12 ]  
Grad Student
Rank
Total Posts:  85
Joined  11-13-2008

Gosh that was quick ! It is good to know at least that I can stop heading down this direction grin I will use your plugin in other ways though ... so that is great.

While I am here, do you know how a member Profile drop down list natively works as a drop down list from the custom profile fields ? I am finding my self populating, by hand, both the custom profile field in EE member temlate and then again in the actual SAEF registration form.???

Thanks Mark.

Profile
 
 
Posted: 08 April 2009 06:05 AM   [ Ignore ]   [ # 13 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006

Hiya,

journalistone - 08 April 2009 05:49 AM

While I am here, do you know how a member Profile drop down list natively works as a drop down list from the custom profile fields?

That will be some of the core ExpressionEngine code that creates those drop-downs so not too sure where it lives but would definitely be in one of the core files possibly something like the system->modules->member->mod.member.php file or somewhere like that I would imagine.

journalistone - 08 April 2009 05:49 AM

I am finding my self populating, by hand, both the custom profile field in EE member temlate and then again in the actual SAEF registration form.???

Thanks Mark.

Not sure if it will work in the registration form or not but I have very very quickly modified the original plugin to create a new plugin which will only work with custom profile fields instead. Please note that it can only be used for Profile fields and not weblog fields as this was done very quickly.

Pretty much the same code as before but with a slight name change :

<select id="{exp:custom_drop_down_profile:field_id field_name="profile-drop-down"}" name="{exp:custom_drop_down_profile:field_id field_name="profile-drop-down"}">

{exp:custom_drop_down_profile field_name="profile-drop-down" initial_value_value="my-value" initial_value_option="Choose an option&hellip;"}
<option value="{value}">{value}</option>
{/exp:custom_drop_down_profile}

</select>

Hope it helps a bit. As said before though I know this should work in normal templates that you create in the Templates area but as to using this plugin in the registration templates I’m not so sure of.

Best wishes,

Mark

File Attachments
pi.custom_drop_down_profile.php.zip  (File Size: 2KB - Downloads: 129)
 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 08 April 2009 06:24 AM   [ Ignore ]   [ # 14 ]  
Grad Student
Rank
Total Posts:  85
Joined  11-13-2008

Hi Hi Hi !!!

I won’t get too excited, and say things like ‘I could kiss you’ - but I just quickly installed the new plugin, and relevant code into the SAEF Registration form… and whamo, It Worked !!!! I submitted a new test registration form and everything went smoothly, right through to the database !!!

THANK YOU MARK ...

Profile
 
 
Posted: 08 April 2009 06:33 AM   [ Ignore ]   [ # 15 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10797
Joined  04-15-2006
journalistone - 08 April 2009 06:24 AM

Hi Hi Hi !!!

I won’t get too excited, and say things like ‘I could kiss you’ - but I just quickly installed the new plugin, and relevant code into the SAEF Registration form… and whamo, It Worked !!!! I submitted a new test registration form and everything went smoothly, right through to the database !!!

THANK YOU MARK ...

Excellent!!

Shows me something too, that plugins can indeed be used in such circumstances so thanks for letting me know grin

Hope everything else goes well for you.

Best wishes,

Mark

 Signature 

Shopping Cart Plugin
Full list of add-ons
———————————————————-
Buy me a drink, or two if you like!!

Profile
 
 
Posted: 18 December 2009 02:09 AM   [ Ignore ]   [ # 16 ]  
Summer Student
Total Posts:  1
Joined  06-11-2009

Thanks! very useful plugin

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120170 Total Logged-in Users: 52
Total Topics: 126296 Total Anonymous Users: 27
Total Replies: 664218 Total Guests: 315
Total Posts: 790514    
Members ( View Memberlist )