vendredi 23 janvier 2015

Backbone can't uncheck the checkbox

I have a form with some field, and there is a special checkbox which shows only when a client has certain IP address. The problem is that I can't uncheck the input even though there is an event bind to it. Here is some code: HTML



{if $rhOptions==1}
<label class"label">
<span class="label-name">Tel order:</span>
<input type="checkbox" name="zamow_tel" {if $user.zamow_tel}checked{/if}>
</label>
{/if}


JS



UserView.prototype.events = {
'keyup :input': 'silentSave',
'submit form': 'submit',
**'change input:checkbox': 'checkbox',**
'click [data-copy]': 'copy',
'change [name="type"]': 'type'
};
UserView.prototype.silentSave = function() {
var data;
data = this.$('form').serializeForm();
return this.model.set(data, {
silent: true
});
};

UserView.prototype.checkbox = function() {
this.silentSave();
return this.render();
};


For other inputs the view is rerendered. Does anybody know what is wrong? Thx in adnavce





Aucun commentaire:

Enregistrer un commentaire