1. #1
    Sencha User talha06's Avatar
    Join Date
    Jul 2009
    Location
    Turkey
    Posts
    303
    Answers
    8
    Vote Rating
    0
    talha06 is on a distinguished road

      0  

    Default Unanswered: User-defined validation doesn't bind button

    Unanswered: User-defined validation doesn't bind button


    Hi everyone,

    I defined a validation which controls if the id is unique or not to bind a button. It works well with built-in validations well, but it doesn't bind for my own validation.

    Here's what I've tried:

    View - FormPanel:

    Code:
    Ext.define(appName + '.view.user.UserForm', {
        extend: 'Ext.form.Panel',
        requires: [appName + '.view.language.LanguageCombo'],
        alias: 'widget.userform',
        //	title		: 'User Form',
        iconCls: 'icon-form',
        frame: true,
        padding: '5 5 0 5',
        border: true,
        buttonAlign: 'right',
        width: '100%',
        //    height	: 200,
        monitorValid: true,
        bodyPadding: 10,
        fieldDefaults: {
            labelAlign: 'left',
            labelWidth: 110,
            anchor: '98%',
            allowBlank: false,
            selectOnFocus: true,
            msgTarget: 'side'
        },
        initComponent: function () {
            var me = this;
    
    
            this.title = bundle.getMsg('userform.title');
    
    
            this.items = [{
                xtype: 'numberfield',
                minValue: 1,
                fieldLabel: bundle.getMsg('userform.field.recordId'),
                name: 'recordId',
                itemId: 'recordId'
            }, {
             ];
    
    
            this.btnReset = Ext.create('Ext.ux.button.ResetButton', {
                handler: function (btn) {
                    me.getForm().reset();
                }
            });
    
    
            this.btnSubmit = Ext.create('Ext.ux.button.SaveButton', {
                disabled: true, 
                formBind: true
            });
    
    
            this.buttons = [me.btnReset, me.btnSubmit];
    
    
            this.callParent(arguments);
        }
    });
    Controller Method:

    Code:
    var form = this.getUserForm();
    if (field.getValue() && field.getValue() != '') {
        Ext.Ajax.request({
            url: 'user/chkRecordIdUnique.ajax',
            method: 'POST',
            params: {
                recordId: field.getValue()
            },
            success: function (response, options) {
                var res = Ext.decode(response.responseText);
                if (!res.success) {
                    field.markInvalid(bundle.getMsg('record.taken'));
                    form.getForm().markInvalid(bundle.getMsg('record.taken'));
                }
            }
        });
    }
    "People will never forget how you made them feel."
    linkedin.com/in/talhakabakus

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,798
    Answers
    3467
    Vote Rating
    834
    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


    You mean where you did the markInvalid?
    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 talha06's Avatar
    Join Date
    Jul 2009
    Location
    Turkey
    Posts
    303
    Answers
    8
    Vote Rating
    0
    talha06 is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    You mean where you did the markInvalid?
    In controller, I added a blur event handler on the field that named "recordId" in the form. The method implementation is above. Even I mark the field as invalid (also I tried marking form as invalid too), it never binds the formBind:true button which is named btnSubmit.
    "People will never forget how you made them feel."
    linkedin.com/in/talhakabakus

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