5

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

2

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

JFormHelper::loadFieldClass('radio');

$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, privacy policy and cookie policy

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