1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    3
    Vote Rating
    0
    peturkirke is on a distinguished road

      0  

    Default checkbox and formbind

    checkbox and formbind


    When using formbind in ext js 3, i can setup my textfields like this:

    items:[{
    name:'Username',
    allowBlank:false
    },{
    name:'Password',
    inputType:'password',
    allowBlank:false
    }],

    but how do i setup a checkbox, which i want to be checked, using formbind, something like allownotchecked: false ?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,791
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Something like this?

    Code:
    Ext.ns('Ext.ux.form');
    
    Ext.ux.form.Checkbox = Ext.extend(Ext.form.Checkbox, {
        blankText : 'This field is required',
    
        getErrors : function() {
            var errors = Ext.ux.form.Checkbox.superclass.getErrors.call(this);
    
            if (this.allowBlank === false && !this.getValue()) {
                errors.push(this.blankText);
            }
    
            return errors;
        }
    });
    
    Ext.reg('ux-checkbox', Ext.ux.form.Checkbox);
    
    Ext.onReady(function() {
    
        new Ext.form.FormPanel({
            renderTo     : document.body,
            title        : 'Test',
            monitorValid : true,
            items        : [
                {
                    xtype      : 'textfield',
                    fieldLabel : 'Test',
                    allowBlank : false
                },
                {
                    xtype      : 'ux-checkbox',
                    fieldLabel : 'Test',
                    allowBlank : false
                }
            ],
            buttons      : [
                {
                    xtype    : 'button',
                    text     : 'Submit',
                    formBind : true
                }
            ]
        });
    
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Mar 2013
    Posts
    3
    Vote Rating
    0
    peturkirke is on a distinguished road

      0  

    Default


    hmm, i think so, in fact i only wanted to know the syntax in the item area for saying that the checkbox must be
    checked, so i guess i can also use allowBlank for checkbox just like for textfields ? I will try it tomorrow, thanks for your help

  4. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,791
    Vote Rating
    833
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    allowBlank won't work on it's own, so if you look at my example I actually extended Combobox to handle it.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  5. #5
    Sencha User
    Join Date
    Mar 2013
    Posts
    3
    Vote Rating
    0
    peturkirke is on a distinguished road

      0  

    Default


    ok ... thanks again

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi