1. #101
    Sencha Premium Member MichaelOstrovsky's Avatar
    Join Date
    May 2008
    Location
    Tel Aviv, Israel
    Posts
    135
    Vote Rating
    6
    MichaelOstrovsky is on a distinguished road

      0  

    Default


    i have modified the plugin a bit to allow setting initial 'remote valid' state. for example, when loading a form from db, its not nice to show 'not verified yet' right ahead.

    now, you can set 'remoteValid' property initially in field.

    Code:
    ...
    Ext.ux.plugins.RemoteValidator = {
    	init:function(field) {
    		// save original functions
    		var isValid = field.isValid;
    		var validate = field.validate;
    
    		// apply remote validation to field
    		Ext.apply(field, {
    			 remoteValid:!!field.remoteValid  //Michael
    
    			// private
    			,isValid:function(preventMark) {
    				return isValid.call(this, preventMark) && this.remoteValid;
    			}
    ...

  2. #102
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,506
    Vote Rating
    373
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    Thank you for the patch.
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  3. #103
    Ext Premium Member
    Join Date
    Mar 2007
    Posts
    123
    Vote Rating
    0
    x5150 is on a distinguished road

      0  

    Default does it work with file upload types?

    does it work with file upload types?


    Is it supposed to work with file uploads also? I have it working with the following code but does not validate when uncommenting inputType.

    Code:
    xtype: 'textfield',
    fieldLabel: 'Select File to Upload',
    //inputType: 'file',
    autoCreate: {tag: "input", type: "text", size: "60", autocomplete: "off"},
    plugins:[new Ext.ux.form.ServerValidator({
    url:'foo',
    params:{foo:bar}
    } )],

  4. #104
    Ext User Dave.Sanders's Avatar
    Join Date
    Mar 2008
    Posts
    131
    Vote Rating
    0
    Dave.Sanders is on a distinguished road

      0  

    Default


    Saki, possibly another bug:

    I think filterServerValidation needs to check for blank fields and disregard the validation if the field is allowBlank:true. I was having some problems when I was tabbing through a set of fields where one of the fields was a remote validator, but it was ok to be blank. (basically, I only validate IF they enter something.)

    I changed filterServerValidation to this:

    Code:
            ,filterServerValidation:function(e) {
                    if(this.field.value === this.field.getValue() || 
    		(this.field.getValue() == "" && this.field.allowBlank)) {
                            this.serverValidationTask.cancel();
                            this.field.serverValid = true;
                            return;
                    }
                    if(!e.isNavKeyPress()) {
                            this.serverValidationTask.delay(this.validationDelay);
                    }
            }

  5. #105
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,506
    Vote Rating
    373
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  6. #106
    Ext Premium Member
    Join Date
    Mar 2007
    Posts
    123
    Vote Rating
    0
    x5150 is on a distinguished road

      0  

    Default


    Quote Originally Posted by jsakalos View Post
    What am I looking for?

  7. #107
    Ext Premium Member
    Join Date
    Mar 2007
    Posts
    123
    Vote Rating
    0
    x5150 is on a distinguished road

      0  

    Default


    I don't know what you are referring to in the docs, there isn't an example with file upload types and not much else there. I've tried changing the validateEvent to 'change' and 'blur' but no async call. Please help.

  8. #108
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,506
    Vote Rating
    373
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    @x5150,

    I haven't tried file upload fields with the validator. The first questions to answer would be:

    1. does field upload field fire events as text field? If not, then there is little chance to make it working.
    2. what getValue() returns?
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM


  9. #109
    Ext Premium Member
    Join Date
    Mar 2007
    Posts
    123
    Vote Rating
    0
    x5150 is on a distinguished road

      0  

    Default


    Quote Originally Posted by jsakalos View Post
    @x5150,

    I haven't tried file upload fields with the validator. The first questions to answer would be:

    1. does field upload field fire events as text field? If not, then there is little chance to make it working.
    2. what getValue() returns?
    1. yes it does fire at least a 'change' event after file selection

    2. returns the filename

  10. #110
    Sencha - Community Support Team jsakalos's Avatar
    Join Date
    Apr 2007
    Location
    Slovakia
    Posts
    27,506
    Vote Rating
    373
    jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future jsakalos has a brilliant future

      0  

    Default


    So if you set validationEvent:'change' it should work... If not, can you post a showcase?
    Jozef Sakalos, aka Saki

    Education, extensions and services for developers at new http://extjs.eu
    News: Grid Search Plugin, ExtJS 5 Complex Data Binding using MVVM