Hybrid View

  1. #1
    Sencha User
    Join Date
    May 2008
    Location
    Belgium
    Posts
    36
    Vote Rating
    0
    EducatedFool is on a distinguished road

      0  

    Default lost in form validation

    lost in form validation


    Hello,

    I found out something strange (in my eyes) about the validators.

    I have a simple form, where I validate the email adres. When I create the form there's no problem (for adding records to my database). But when I want the edit a record, I create the form and call the onLoad-function to load the data. From that moment it calls the email-validator, and it just keeps validating the email adres. You don't see it, but I tested it by adding console.log(v); in the source. And it won't stop. Why is this? Does this has a reason?

    Why am I asking? For the email validator it's not a problem. But I'm creating my own validators, with ajax request to the server (e.g. to validate double-entries), it just keeps firing those ajax request that make a lot of trafic offcourse.

    remark: this is only happening with monitorValid = true

    ext-all-debug
    PHP Code:
    Ext.form.VTypes = function () {
        ..
        return {
            
    'email': function (v) {
                
    console.log(v);
                return 
    email.test(v);
            },
        }... 

    mycode:
    PHP Code:
    form = new MyApp.TestObject.form();
    form.onLoad();
     
    MyApp.TestObject.form Ext.extend(Ext.FormPanel, {
        
    initComponent: function () {
            
    Ext.apply(this, {
                
    url'',
                
    defaultType'textfield',
                
    monitorValidtrue,
                
    items: [{
                    
    name'email',
                    
    xtype'textfield',
                    
    allowBlanktrue,
                    
    fieldLabel'email',
                    
    vtype'email'
                
    }],
                
    buttons: [{
                    
    text'Opslaan',
                    
    formBindtrue,
                    
    scopethis,
                    
    handlerthis.formSubmit
                
    }]
            }) 
    // eo apply
            
    Ext.apply(thisExt.apply(this.initialConfigthis.config));
            
    MyApp.TestObject.form.superclass.initComponent.apply(thisarguments);
        } 
    // eo init
        
    ,
        
    onLoad: function () {
            
    this.load({
                
    url'/' module '/' controller '/get',
                
    waitMsg'Loading...',
                
    params: {
                    
    idthis.notaris_id
                
    },
                
    success: function () {}
            });
        } 

  2. #2
    Sencha User
    Join Date
    Feb 2009
    Location
    Glasgow, Scotland
    Posts
    293
    Vote Rating
    5
    Stuart-SwarmOnline will become famous soon enough

      0  

    Default


    By setting monitorValid to true the form is constantly checking all the fields for valid status so that the red squiggly line and warning icon appear/dissappear. So if you have a complicated vtype with an ajax request it is going to slow things down and hit the server a lot. If you listen for the clientvalidation event you will see how often it fires.

    You could set monitorValid to false and set up your own period validation checks or wait until a button is pressed before you do the isValid check.

Similar Threads

  1. EditorGridPanel: data entered is lost on failed validation
    By Event Horizon in forum Ext 2.x: Help & Discussion
    Replies: 25
    Last Post: 17 Sep 2012, 7:19 AM
  2. form field lost in tabpanel
    By joshuaxu in forum Ext 2.x: Help & Discussion
    Replies: 5
    Last Post: 29 Jun 2009, 12:06 AM
  3. Form validation with form made up of multiple dynamically added tabs
    By Mat Malone in forum Ext 2.x: Help & Discussion
    Replies: 4
    Last Post: 29 Aug 2008, 7:57 AM
  4. applying ext js form validation to the html form
    By kavithav in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 18 Aug 2008, 12:09 PM
  5. Server-side form-validation: How to load errors into a form?
    By wuschba in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 9 Jun 2008, 8:05 AM

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