How To Get Smarty html_radios To Display An ID

Add the parameter label_ids=true. For example:
1 |
{html_radios name="yourName" label_ids=true options=$yourOptions selected=$smarty.request.yourName separator="<br/>"} |
![]() |
Add the parameter label_ids=true. For example:
1 |
{html_radios name="yourName" label_ids=true options=$yourOptions selected=$smarty.request.yourName separator="<br/>"} |
How To Get the Value of a Selected Radio Button in a Specific Form: jQuery(‘input[name=radioName]:checked’, ‘#yourForm’).val()
1 2 3 4 5 6 7 8 9 |
if ( ! jQuery('input[name=yourRadioGroup]').is(':checked') ) return false; ~OR~ if (! jQuery('input[name=yourRadioGroup]:checked').val()) { alert('Please make a selection...'); } else { alert('Thank you for making a selection!'); } |
The jQuery
1 2 3 4 |
jQuery('#yourForm label') .live( 'click', function () { jQuery(this).attr('checked','checked'); }); |
The HTML
1 2 3 4 |
<form id="yourForm" method="post" action="/"> <label for="radio1"><input type="radio" name="fruit" value="apple" id="radio1">Click here for Apples</label> <label for="radio2"><input type="radio" name="fruit" value="pear" id="radio2">Click here for Pears</label> </form> |