1 of 2
1
[New Extension] Sarge: Drop-down field enhancer
Posted: 04 April 2008 02:26 AM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  279
Joined  01-02-2008

Over the next few days, I’m going to be releasing a few extensions I’ve written for Navigant.

First on the list is Sarge, a simple extension that adds <optgroup> support to the Drop-down List field type, and lets you specify the value of each option.

Example “Select Options” textarea:

Select an option... =

[optgroup] = Group 1
    Option 1
= value_1
    Option 2
= value_2
    Option 3
= value_3
[
/optgroup]
Other Option 1
= value_4
Other Option 2
= value_5

Note that specifying each value is optional. If you don’t add an equal sign (=) the option will work just like it would without this extension (the value gets set to the name of the option).

For more information and the download, go to http://brandon-kelly.com/apps/sarge/

Enjoy!

 Signature 

brandon-kelly.com    @brandonkelly

Profile
 
 
Posted: 04 April 2008 02:31 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  918
Joined  02-05-2002

Nice one Brandon!

I am kind of expecting (hoping) that EE 2 will let you specify the value for each option…  We’ll see.

Keep ‘m coming smile

 Signature 

Member of the EE Pro Network

Profile
 
 
Posted: 04 April 2008 02:57 AM   [ Ignore ]   [ # 2 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10827
Joined  04-15-2006

Excellent Brandon,

I’m sure a lot of people are going to find that very handy. I’m off to have a play now in case I can use it on anything wink

Always like to try out every single extension, module and plugin that there is and see how they all work.

Well done private Brandon. Consider yourself a first-class officer. Atteeeeeeeeeen-tion!! wink

Best wishes,

Mark

 Signature 

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

Profile
 
 
Posted: 04 April 2008 02:02 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  279
Joined  01-02-2008
Cocoaholic - 04 April 2008 02:31 AM

I am kind of expecting (hoping) that EE 2 will let you specify the value for each option…  We’ll see.

I wouldn’t be surprised… cp.publish.php already uses their input_select_option method to build the list, which accepts a value parameter.

But this extension was too easy to write to wait around for EE 2.

 Signature 

brandon-kelly.com    @brandonkelly

Profile
 
 
Posted: 04 April 2008 06:58 PM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1306
Joined  01-24-2006

Its little extensions like this I love!

They just add that little thing missing from the system that comes in handy every now and then.

Well done

 Signature 

Newism - Newcastle Web Design & Development


NSM Publish Plus - Collaborative workflow and live entry previews
LG Better Meta - SEO Meta & XML Sitemap Generator
LG Polls
LG .htaccess Generator
20+ EE addons

Profile
 
 
Posted: 04 April 2008 07:04 PM   [ Ignore ]   [ # 5 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10827
Joined  04-15-2006
brandon.kelly - 04 April 2008 02:02 PM

But this extension was too easy to write to wait around for EE 2.

Well that’s easier said by someone who knows what they are doing wink

I for one wouldn’t have even known what that hook was going on about in the first place let alone know what to code to do anything with it!! wink

Great extension Brandon, thanks again. I’m sure this will come in handy somewhere along the line for me and I would think for a lot of other users too so thanks for that.

Best wishes,

Mark

 Signature 

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

Profile
 
 
Posted: 04 April 2008 11:40 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  523
Joined  03-18-2007

What are people using this extension for? It just affects the Control Panel right? Is it mostly to help the site admins be more organized?

 Signature 

Follow me on Twitter: twitter.com/mrw

Profile
 
 
Posted: 05 April 2008 04:54 AM   [ Ignore ]   [ # 7 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1917
Joined  01-05-2007

Did anyone else giggle at the big “Powered by Movable Type” Logo in the footer of Brandon’s site?

Great extension!

 Signature 

 
Steven Hambleton | Follow me on Twitter!


ExpressionEngine Outsourcing for Marketing, Graphic & Web Agencies
Partner with a professional ExpressionEngine development team to turn your designs into functioning sites.

Profile
 
 
Posted: 05 April 2008 04:59 AM   [ Ignore ]   [ # 8 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10827
Joined  04-15-2006

Well I was going to ask about that actually.

Is your site running off Movable Type or are you moving across to ExpressionEngine with it Brandon?

Best wishes,

Mark

 Signature 

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

Profile
 
 
Posted: 05 April 2008 08:52 AM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  279
Joined  01-02-2008
Mark Bowen - 05 April 2008 04:59 AM

Is your site running off Movable Type or are you moving across to ExpressionEngine with it Brandon?

No plans to—let’s just say I’m a “right tool for the job” kind-of-guy.  grin

 Signature 

brandon-kelly.com    @brandonkelly

Profile
 
 
Posted: 05 April 2008 09:02 AM   [ Ignore ]   [ # 10 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  10827
Joined  04-15-2006

Good enough answer for me but I just use ExpressionEngine for everything nowadays as I know it so well.

Great extension Brandon, keep ‘em coming! wink

Best wishes,

Mark

 Signature 

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

Profile
 
 
Posted: 05 April 2008 09:06 AM   [ Ignore ]   [ # 11 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  279
Joined  01-02-2008
slapshotw - 04 April 2008 11:40 PM

What are people using this extension for? It just affects the Control Panel right? Is it mostly to help the site admins be more organized?

It’s mainly for the people that are writing content.

I’m using it for an upcoming section on NavigantConsulting.com that will replace their existing “biography database” site. When we’re done, the professionals will be able to log into the CMS and update their profile, and one of the fields is a drop-down list where they select their Office Location. That drop-down, thanks to this extension, is organized into two optgroups: International and United States. (See attachment)

It’s also helpful on the templating side… All those options that start with “CA -” have their values set such that {p_office} shows everything but the “CA -” part.

Image Attachments
nci-office-locations.jpg
Click thumbnail to see full-size image
 Signature 

brandon-kelly.com    @brandonkelly

Profile
 
 
Posted: 15 June 2008 09:02 AM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2124
Joined  03-26-2006

I love this. For example, I always like to show a whole state name in a dropdown, but only store the two-letter code - and this lets me do that easily.

I have a state field where 80% of the entries will be “Michigan”. Any way on the Publish screen to have a default value selected? Would save my client that extra effort of even having to use the dropdown at all.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 15 June 2008 10:40 AM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  279
Joined  01-02-2008
mdesign - 15 June 2008 09:02 AM

I love this. For example, I always like to show a whole state name in a dropdown, but only store the two-letter code - and this lets me do that easily.

Glad you like it!

I have a state field where 80% of the entries will be “Michigan”. Any way on the Publish screen to have a default value selected? Would save my client that extra effort of even having to use the dropdown at all.

You could assign Michigan to no value (Michigan = ), and make sure every other option does have a value (including blank rows—or just remove any of those). Not ideal, but that’s probably the only way to do it.

 Signature 

brandon-kelly.com    @brandonkelly

Profile
 
 
Posted: 15 June 2008 08:24 PM   [ Ignore ]   [ # 14 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2124
Joined  03-26-2006

I was sort of thinking of modding this to look for a “* ” at the front of a line (or something similar), which could output selected=“selected” when it draws that row, but I’m just thinking out loud.

Select an option... =

[optgroup] = Group 1
Option 1
= value_1
* Option 2 = value_2
Option 3
= value_3
[
/optgroup]
Other Option 1
= value_4
Other Option 2
= value_5

Thanks for this, and your suggestion.

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 15 June 2008 10:49 PM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  279
Joined  01-02-2008

OK… I had thought about that but saw a limitation (I’d have no way of knowing if a row further down the line should be selected or not), but I suppose I could have something like that apply only if the fields value is null.

The only issue would be that if you want to select an option without a value, every time you come back to the Edit form you’d have to reselect that option. Although I have a feeling if you’re using the ‘default option’ feature, you probably won’t have any options that have no value to begin with.

 Signature 

brandon-kelly.com    @brandonkelly

Profile
 
 
Posted: 19 December 2008 12:15 AM   [ Ignore ]   [ # 16 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  2124
Joined  03-26-2006

Anyone ever got this to work in a SAEF?

 Signature 

ryan masuga
—————
Masuga Design (EE Pro) | devot:ee
MD Markitup | All Add-Ons
@masuga | @masugadesign | @devot_ee

Profile
 
 
Posted: 12 January 2009 04:08 PM   [ Ignore ]   [ # 17 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  279
Joined  01-02-2008

Sarge 1.2 adds SAEF support (sponsored by Masuga Design).

Get it while it’s hot!

 Signature 

brandon-kelly.com    @brandonkelly

Profile
 
 
Posted: 20 January 2009 06:46 PM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  279
Joined  01-02-2008

I just set up a page for Sarge on Get Satisfaction.

Going forward, please use that venue for support rather than the EE forums.

Thanks!

 Signature 

brandon-kelly.com    @brandonkelly

Profile
 
 
   
1 of 2
1
 
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: 120350 Total Logged-in Users: 84
Total Topics: 126475 Total Anonymous Users: 67
Total Replies: 665096 Total Guests: 445
Total Posts: 791571    
Members ( View Memberlist )
Newest Members:  RanjanjoyMihai NorthThatchVagariPatient ShareNixnizviVadotlogikCariNetX-C0d3C