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
What I would like to see as
Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. It only takes a minute to sign up.
Sign up to join this communityIn 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
What I would like to see as
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.