Hey everybody. Thought you would all be interested in a little fix I came across when I was unable to use the CJuiSlider helper class to properly build a slider with a fixed min/max to show a fill bar for input.

in framework/zii/widgets/jui change lines 111-115 to the following:

if( (string)$this->options['range'] != 'min' && (string)$this->options['range'] != 'max' ) {

   echo CHtml::activeHiddenField($this->model,$this->maxAttribute,$options);




Tested with the other varieties of slider input and it works fine. Hope it helps.

What’s the problem in the first place? Would you please provide some code to reproduce it?

The class, as far I can tell, does not provide a way to set the range min or max which makes the control “fill” to start from the beginning or end. This means the only option was to have a slider with only a handle and not a progressively filled bar. The documentation of the control allows for “range” to not only be set to true/false but also a string of ‘min’ or ‘max’ so that the bar can be provided with a fill bar anchored to the max or min. I could not find a way to accomplish this without modifying the provided helper class which I did and am sharing the modification with all of you.

Anyways, I did end up finding a problem with my previous submission. Here is an update to fix it:

starting at line111

if( (string)$this->options['range'] != 'min' && (string)$this->options['range'] != 'max' ) {

	echo CHtml::activeHiddenField($this->model,$this->maxAttribute,$options);



} else {



I found 1 problem with my quickfix that prevented the single attribute behavior of setting the range to ‘min’ or ‘max’ from happening. I added a boolean to flip when it ran through my previously submitted code. This is used on line 144 such that:

$this->options[$this->event]= ($isRange && !$isMinMaxRange) ?

			"js:function(e,ui){ v=ui.values; jQuery('#{$idHidden}').val(v[0]); jQuery('#{$idHidden}_end').val(v[1]); }":

			'js:function(event, ui) { jQuery(\'#'. $idHidden .'\').val(ui.value); }';

Probably a better way to accomplish this, but I like my duct tape.

Great fix! I was looking at this yesterday and came up with a very similar fix.


I want to have a CJuiSliderInput on my page which has one value, so I don’t really need to use a range but I really like the way you can colour the left of the bar using a fixed minimum range of 0.

However I have tried your code fix which works and I now get the coloured bar but the values that are shown on screen and when submitted do not change.

My code is

<div id="coords_2d_y"><?php echo $model->coords_2d_y?></div>

<?php $this->widget('zii.widgets.jui.CJuiSliderInput', array(







Any ideas?

Note: there is an opened related issue.