Move the change event to the input element

This should bubble to the parent control element and persist any logic that depends on the old event
Fixes #2684
This commit is contained in:
Samuel Georges 2017-04-06 08:08:50 +10:00
parent 328a74c1ff
commit 5daf4365ae
3 changed files with 16 additions and 9 deletions

View File

@ -13,5 +13,10 @@
<?php endforeach ?>
</ul>
<input type="hidden" name="<?= $field->getName() ?>" value="<?= e($field->value) ?>"/>
</div>
<input
type="hidden"
name="<?= $field->getName() ?>"
id="<?= $field->getId() ?>"
value="<?= e($field->value) ?>"
/>
</div>

View File

@ -16,13 +16,17 @@
var self = this;
$('li', this.$el).click(function(){
if (self.$el.hasClass('control-disabled'))
if (self.$el.hasClass('control-disabled')) {
return
}
$('li', self.$el).removeClass('active')
$(this).addClass('active')
self.$field.val($(this).data('value'))
self.$el.trigger('change')
self.$field
.val($(this).data('value'))
.trigger('change')
})
}

View File

@ -2664,12 +2664,10 @@ $el.prop('checked',false)}
$el.trigger('change')
return false})})(jQuery);+function($){"use strict";var BalloonSelector=function(element,options){this.$el=$(element)
this.$field=$('input',this.$el)
this.options=options||{};var self=this;$('li',this.$el).click(function(){if(self.$el.hasClass('control-disabled'))
return
this.options=options||{};var self=this;$('li',this.$el).click(function(){if(self.$el.hasClass('control-disabled')){return}
$('li',self.$el).removeClass('active')
$(this).addClass('active')
self.$field.val($(this).data('value'))
self.$el.trigger('change')})}
self.$field.val($(this).data('value')).trigger('change')})}
BalloonSelector.DEFAULTS={}
var old=$.fn.balloonSelector
$.fn.balloonSelector=function(option){return this.each(function(){var $this=$(this)