Skip to content

Commit

Permalink
Ok, here's a better solution that doesnt act rude on checkboxes
Browse files Browse the repository at this point in the history
  • Loading branch information
Inviz committed Dec 1, 2011
1 parent 5edee05 commit f8c68f1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Source/Mixin/Fieldset.js
Expand Up @@ -149,8 +149,8 @@ LSD.Mixin.Fieldset = new Class({
}
}.bind(this)
callback._callback = this;
this.fields.set(name, widget)
this.values.set(name, widget.getValue())
if (LSD.Mixin.Command.getCommandType.call(widget) == 'command')
this.values.set(name, widget.getValue());
widget.states.watch('checked', callback);
var key = widget.lsd + ':value:callback'
var callback = this.retrieve(key);
Expand All @@ -163,6 +163,7 @@ LSD.Mixin.Fieldset = new Class({
this.store(key, callback)
}
widget.addEvent('change', callback);
this.fields.set(name, widget)
},

getParams: function(object) {
Expand All @@ -179,11 +180,9 @@ LSD.Mixin.Fieldset = new Class({
removeField: function(widget) {
var name = widget.attributes.name;
if (!name) return;
widget.states.unwatch('checked', this);
this.fields.unset(name, widget)
if (LSD.Mixin.Command.getCommandType.call(this) == 'command')
this.values.unset(name, widget.getValue())
else
widget.states.unwatch('checked', this);
this.values.unset(name, widget.getValue());
var key = widget.lsd + ':value:callback'
var callback = this.retrieve(key);
if (callback) widget.removeEvent('change', callback);
Expand Down

0 comments on commit f8c68f1

Please sign in to comment.