Here’s a new plugin I just made a minute ago. It will take plain text and turn it into a <select> drop down box. This is useful for when you need to have the customer populate a drop down, but they are afraid of learning HTML.
{exp:select_generator name="month" onChange="alert('changed');"}
1:January
2:February
Other
{/exp:select_generator}
Have fun!
Update: * Use # in the value to make a new <optgroup>. * Use (selected) in the value to select an item. * Submitted form data will be compared with the values and will automatically select the appropriate <option>s.
Hi Robert,
Looks like this could be a nice addition to EE for clients but have just tried installing it and it doesn’t appear to appear in the installed Plugins list.
I don’t think I have done anything wrong. This was on a fresh install of EE 1.6.1 on a local dev install.
Best wishes,
Mark
P.S. How exactly would people use this plugin? Would you just have a custom text-area field and get the client to place their items in that? At the moment the code you show above shows the plugin code wrapped around items but I guess you would just place the custom field code where they are at the moment?
Sorry you can’t see it in your plugin manager, I just downloaded the one I uploaded and tried it, and it works for me. But I’m using 1.6 because I’m too lazy to update. Please let me know if you figure it out.
You are exactly right with the intended usage, make a custom weblog field, and put that inside the EE tag instead of the text in the example.
Thank you Victor for the # idea, I was trying to figure out how to do that in a friendly way.
I also added “selected” support in two ways: 1) If you type (selected) before an entry it will select it. 2) Any form data submitted to the page will select the appropriate options.
{exp:select_generator name="test_name" id="test_id" onChange="alert('changed');"}
Regular Entry
#:numbers
(selected)1:One
2:Two
#:states
ca:California
nv:Nevada
{/exp:select_generator}
I’m not adding disabling right now 😊 I’m tired and I need to work in a few hours. And I think I’ll use the Google 70% rule here and say that 70% of the people using this plugin won’t care about disabling options.
I just tested it on a site running 1.6.1 that we did, and it shows up in the Plugin Manager. It’s called “Select Generator” by the way.
It’s my first plugin, so I don’t know why a plugin wouldn’t show up, and it shows up on two separate machines running different versions of EE. So I’m sorry, I don’t know how to help.
Hi Robert,
I don’t understand it either. I have now tried another 3 times and it still doesn’t show up for some reason. I tried it on an older V1.5.2 of EE and it came up fine but every time I install a brand new 1.6.1 on my localhost it doesn’t work.
I will take a look at this again a bit later on and see if I am doing something silly. Pretty sure I’m not though.
Maybe anyone else who downloads this and tries it out on 1.6.1 - 20071113 could let us know how it goes for them?
Best wishes,
Mark
Hi Victor,
Must be me then!! :-(
Have tried so many times now though and I know for a fact that I am installing it all correctly. Maybe this doesn’t work well on a localhost install?
The V1.5.2 that I tried it on was on an actual web-server but all the 1.6.1 installs are on MAMP on OSX.
Will maybe try a bit later on with a web-server install and let you know how it goes.
Best wishes,
Mark
Hi Robert,
Just to let you know that I found out what it was in the end. When I download your plugin the permissions are set a little odd when I unzip it. Usually on MAMP I just pop the plugin into the plugins folder and it all works fine. This however needed me to get info on it and set some permissions first as it had no access set on it.
It now shows up fine in the plugins manager. Going to try it out now!! 😊
Thanks again.
Best wishes,
Mark
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.