Hybrid View

  1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    22
    Vote Rating
    0
    ansis_si is on a distinguished road

      0  

    Question allowBlank:false, on html editor not working ?

    allowBlank:false, on html editor not working ?


    why function allowBlank:false, on my fieldset is not working ? this is my code :

    form with fieldset :
    Code:
    ...
        formReplyWeb = new Ext.FormPanel({
            frame: true,
            baseCls: 'x-panel',
            labelAlign: 'left',
            labelWidth: 100,
            url: '/TA/data/webdata.jsp?type=3&id='+selectedWebDetailId,
            method: 'POST',
            waitMsgTarget: true,
            items: [
                new Ext.form.FieldSet({
                    title: 'Tulis pesan baru',
                    iconCls: 'webEdit',
                    autoHeight: true,
                    autoWidth: true,
                    buttonAlign:'right',
                    defaultType: 'textfield',
                    items: [
                        webSender,
                        webSubject,
                        webProductID,
                        webCreatedDate,
                        webMessage,
                        webReply        // <----- this is the html editor field
                    ],
                    buttons: [{
                        text: 'Kirim',
                        handler: sendWEB
                    },{
                        text: 'Reset',
                        handler : resetWebFSData
                    },{
                        text: 'Tutup',
                        handler : function() {winReplyWeb.hide();}
                    }]
                })
            ]
        });
    ...
    this is the html editor as an input field :

    Code:
    ...
    var webReply = new Ext.form.HtmlEditor({
            id:'webReply',
            name: 'webReply',
            fieldLabel: 'Pesan balasan ',
            width:500,
            height:200,
            allowBlank: false,                // <--------------- not working / functioning
            enableFormat:false,
            autocomplete:'off',
            enableSourceEdit: false,
            enableColors : false,
            enableFont : false,
            //labelWidth: 5,
            labelSeparator:''
        });
    ...
    what wrong with that ??

  2. #2
    Ext User
    Join Date
    Feb 2009
    Posts
    2
    Vote Rating
    0
    saadus is on a distinguished road

      0  

    Default


    fix:

    Code:
            Ext.override(Ext.form.HtmlEditor, {
                markInvalid: function(msg){
                    if(!this.rendered || this.preventMark){
                        return;
                    }
                    msg = msg || this.invalidText;
                    switch(this.msgTarget){
                        case 'qtip':
                            this.iframe.qtip = msg;
                            this.iframe.qclass = 'x-form-invalid-tip';
                            Ext.get(this.iframe).addClass(this.invalidClass);
                            
                            break;
                    }
                    return Ext.form.TextArea.superclass.markInvalid.call(this, [msg]);
                },
                clearInvalid: function(){
                    if(!this.rendered || this.preventMark){
                        return;
                    }
                    switch(this.msgTarget){
                        case 'qtip':
                            this.iframe.qtip = '';
                            Ext.get(this.iframe).removeClass(this.invalidClass);
                            break;
                    }
                    return Ext.form.TextArea.superclass.clearInvalid.call(this);
                },
                validateValue:function(){
                    if(this.allowBlank==false){
    
                        var value =this.getRawValue();
                        value = value.replace(/&nbsp;/gi,"");
                        value = value.replace(/<br>/gi,"");
                        value = value.trim();
                        if(value != ''){
                            this.clearInvalid();
                            return true;
                         }
                        else{
                            this.markInvalid("This field is required.")
                            return false;
                            }
                    }else{
                        this.clearInvalid();
                        return true;
                    }
    
    
                }
    });
    
    Ext.form.HtmlEditor.prototype.listeners={ sync: function(t,html){
                                                 t.validateValue();
                                            }
                                        };

  3. #3
    Sencha User
    Join Date
    Feb 2010
    Location
    Brescia
    Posts
    60
    Vote Rating
    0
    ladro1987 is on a distinguished road

      0  

    Default


    This FIX don't work in IE? There is some solutions?

    Thanks

    Roberto

  4. #4
    Ext User
    Join Date
    Jun 2010
    Posts
    1
    Vote Rating
    0
    agnaldocarmo is on a distinguished road

      0  

    Cool what's wrong

    what's wrong


    did not work in version 3.3 extjs, what's wrong?

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    93
    Vote Rating
    2
    darkhorni is on a distinguished road

      0  

    Exclamation "allowBlank: false" is not working

    "allowBlank: false" is not working


    I have the same problem with allowBlank. I have field and allowBlank: false does not work.

    Code:
    {
                    xtype : 'field',
                    id: 'ozelKod',
                    allowBlank: false,
                    fieldLabel : 'Özel Kod',
                    name : 'ozelKod'
                }
    It does not become required field.


    Edit: I have solved. Instead of field use textfield.
    Last edited by darkhorni; 5 Sep 2011 at 10:51 PM. Reason: solved

  6. #6
    Sencha User
    Join Date
    Jun 2009
    Location
    Burlington, Ontario
    Posts
    174
    Vote Rating
    2
    Bleak is on a distinguished road

      0  

    Default


    The HTMLEditor does not support allowBlank, which is extremely frustrating..