We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Radio Button

Development and Programming

Mark Huot's avatar
Mark Huot
587 posts
18 years ago
Mark Huot's avatar Mark Huot

This extension adds a new custom field type for radio buttons. Just install the extension and you can add radio fields the same way you would add drop down lists.

       
running with scissors's avatar
running with scissors
147 posts
18 years ago
running with scissors's avatar running with scissors

hey mark,

maybe i’m missing something, but after i enabled this plugin and select it in a new custom field, i don’t see any visible “select option”. i assume it is supposed to look similar to the drop-down list? thanks. i’ve attached a grab of what i’m seeing in the cp.

-rws

       
Mark Huot's avatar
Mark Huot
587 posts
18 years ago
Mark Huot's avatar Mark Huot

Try the new version (1.0.2) and see if that fixes this.

       
running with scissors's avatar
running with scissors
147 posts
18 years ago
running with scissors's avatar running with scissors

worked like a charm, thanks mark.

       
running with scissors's avatar
running with scissors
147 posts
18 years ago
running with scissors's avatar running with scissors

hey mark,

this is kind of a little thing, but is it possible to have one of the radio buttons selected as default. perhaps as simple as the first one listed? thanks again for another very useful extension.

-rws

       
Mark Huot's avatar
Mark Huot
587 posts
18 years ago
Mark Huot's avatar Mark Huot

I’ll look into adding this functionality. I am little hesitant because unless I can build a preference to turn off the preselection I’m sure some people would not apprecieate this.

Anyways, if you’d like to alter the file yourself, just find the following lines and make the necesary changes:

// -- Find This
$select = ($item == $field_data) ? true : false;
// -- Change to This
$select = ($item == $field_data || ($field_data == '' && $key==0)) ? true : false;

// -- Find This
$select = ($entry["entry_id"] == $field_data) ? true : false;
// -- Change to This
$select = ($entry["entry_id"] == $field_data || ($field_data == '' && $key==0)) ? true : false;

That’s off the top of my head though, so let me know if this works.

       
running with scissors's avatar
running with scissors
147 posts
18 years ago
running with scissors's avatar running with scissors

bingo, works as advertised.

       
stinhambo's avatar
stinhambo
1,268 posts
17 years ago
stinhambo's avatar stinhambo

I just spotted a bug.

If you choose to make a custom field a radio button before you choose none as the formatting option it adds tags automatically.

       
stinhambo's avatar
stinhambo
1,268 posts
17 years ago
stinhambo's avatar stinhambo

It’s still adding paragraph tags automatically so this is my EE code -

{if matting_lip == "Yes" OR matting_lip == "No"}<li>Lip?: {matting_lip}</li>{/if}
{if matting_type == "Smooth" OR matting_type == "Spiked"}<li>Type: {matting_type}</li>{/if}

and I get this -

<li>Lip?: Yes</li>
<li>Type: Spiked</li>

I’m not a PHP wizard so I wouldn’t know how to edit any of this.

Over to you Mark!!

PS. I’m using the latest version of Radio Ext and Version 1.6 Build 20070627 of EE.

       
ms's avatar
ms
274 posts
17 years ago
ms's avatar ms

If I’m correct, there is a plugin Mark has written that strips the <p> tags … its called strip_p or so. That or any other plugin removing html code might work as a workaround?

-Markus

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.