hello,…
I got this idea of using a form field with a spinner on it to change its value, but was unable to find a widget that does that. After some searching, ended up with this:
<script>
$(function() {
var spinner = $( "#Tracktrack_done_hrs" ).spinner({min: '0', max: '8', step: '.1'});
$('#Tracktrack_done_hrs').addClass('my-spinner-css');
$('#Tracktrack_done_hrs').keyup(function () {
this.value = this.value.replace(/[^0-9\.]/g,'');
});
});
</script>
<div class="row">
<?php echo $form->labelEx($model,'track_done_hrs'); ?>
<input id="Tracktrack_done_hrs" name="<?php echo "Track[track_done_hrs]" ?>" value="<?php echo $model->track_done_hrs ?>" />
</div>
I haven’t used Yii that long and really have no experience with jQuery, so my question is, if this would be a valid way of using a field like this, and also if anyone has any advice on it.
thanks,