In the front-end I have a code as below

jimport( 'joomla.html.html.select' );
echo JHtmlSelect::booleanlist('published',null,$this->book->published,'Yes','No')

What I see is as below

enter image description here

What I would like to see as

enter image description here


1 Answer 1


It would be better to just load a JFormFieldRadio it will take care of required scripts.


$field = new JFormFieldRadio();
$field->setup(new SimpleXMLElement('<field name="published" type="radio" size="1" default="0" class="btn-group btn-group-yesno"><option value="0">JNO</option><option value="1">JYES</option></field>'), 1);

echo $field->renderField(array('hiddenLabel'=>true));

This will work on a back-end. If you are trying to make it work on front-end it is possible you will need to update your template too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.