1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    22
    Vote Rating
    0
    lukasw44 is on a distinguished road

      0  

    Default Ext form panel using errorReader

    Ext form panel using errorReader


    hello i have got problem to configure my form and using errorReader

    i have got standard formPanel with some textfield eq. 'role', 'tmpPhoto' etc
    and i need add server validation . In ext site example is only one example with xml, but my server controller (spring) return error validation message as JSON. And this is example JSON error message :
    PHP Code:
    {"success":false,"errors":{"tmpPhoto":"tmpPhoto must not be null","role":"role must not be null"}} 
    so what i get i get root element as errors and fieldName --> error . I wrote something like that:
    PHP Code:
    Ext.define('bandsman.error',{
            
    extend'Ext.data.Model',
            
    fields:['tmpPhoto','role']
        }) 
    And in form i have got :

    PHP Code:
    errorReaderExt.create('Ext.data.reader.Json',{
                
    id'jsonReader',
                
    root'errors',
                
    model'bandsman.error',
                
    successProperty'@success'
                
            
    }), 
    but its not working for me , in errorReader doc they wrote that error message must have got id and msg its so complicated for me ...

    Can yout tell me how can i do this ?

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    7,183
    Vote Rating
    194
    scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold scottmartin is a splendid one to behold

      0  

    Default


    Please read the requirements for errorReader again:
    errorReader should return records with id and msg fields
    [{name: 'id', mapping: 'field'}, {name: 'msg', mapping: 'message'}];

    Scott.

Tags for this Thread