d5f50127e68f1aa97f82c7ea0e6884fcaf9c415e
[ccsdk/features.git] /
1 (function( app ) {
2
3         var ui = app.ns("ui");
4
5         ui.CheckField = ui.AbstractField.extend({
6                 _main_template: function() { return (
7                         { tag: "DIV", id: this.id(), cls: "uiCheckField", children: [
8                                 { tag: "INPUT", type: "checkbox", name: this.config.name, checked: !!this.config.value }
9                         ] }
10                 ); },
11                 validate: function() {
12                         return this.val() || ( ! this.require );
13                 },
14                 val: function( val ) {
15                         if( val === undefined ) {
16                                 return !!this.field.attr( "checked" );
17                         } else {
18                                 this.field.attr( "checked", !!val );
19                         }
20                 }
21         });
22
23 })( this.app );
24
25