1. #21
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,672
    Vote Rating
    748
    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


    When you create the form, create a blank model instance. Then listen to the field's blur event and set that value to the field in the model instance. Then validate and getByField to see if it's valid.

    Not sure if that will work but it should
    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.

  2. #22
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    You guys doing a Form.markInvalid and getting it to display errors on the form? Mine is not. Debugging shows there are errors but no red squigglies...

    PHP Code:
            this.deviceCoverage.getForm().updateRecord(this.deviceCoverageRecord);
            var 
    errors this.deviceCoverageRecord.validate();
            if (!
    errors.isValid()) {
                
    this.deviceCoverage.getForm().markInvalid(errors);
                return;
            } 

  3. #23
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,672
    Vote Rating
    748
    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


    I haven't tried it but your code could be cleaned up a bit, don't take this the wrong way...


    Code:
    var me    = this,
        form  = me.deviceCoverage,
        basic = form.getForm(),
        rec   = me.deviceCoverageRecord;
    
    basic.updateRecord(rec);
    var errors = rec.validate();
    if (!errors.isValid()) {
        basic.markInvalid(errors);
        return;
    }
    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.

  4. #24
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    I noticed that Ext JS 4 uses var me = this; What is the reason behind doing this?

  5. #25
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,672
    Vote Rating
    748
    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


    1. Cuts down 2 characters per reference after the length of the line that creates the 'me' variable
    2. Minifies better

    Sure there are other reasons. I have talked to Jay Garcia and Ed Spencer about it one day and this is what we decided. It's agreed that we don't like it. Only reason I don't is because the IDE (BBEdit) I use highlights 'this' as blue. May be able to do it with 'me' but I'm too lazy.

    You don't always need to do

    Code:
    var me = this;
    On listeners, you can do it.

    Code:
    listeners: {
        afterrender: function(grid) {
            var me = grid;
        }
    }
    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.

  6. #26
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    So debugging the code shows markInvalid wants 'id' and 'msg' but errors.items contains 'field' and 'message'. It appears to be the same data just with different field names. So is the best solution to iterate over errors.items and build a new object with the desired names? Easy to do but will get repetitive for all form validation. I would think that if a form uses a model, it should be able to understand the model's errors.

    Maybe I'm missing something?

  7. #27
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Omaha, NE
    Posts
    529
    Vote Rating
    17
    estesbubba will become famous soon enough

      0  

    Default


    I know this got a little off-topic but back to the "me" code style. Is what I did below:

    var nextButton = me.nextButton = <object> taking it too far for object creation?

    Code:
        index: function(options) {
    
    		var	me = this,
    			app = me.application;
    			
    		if (!options.back) {
    			me.deviceCoverage = Ext.create('Prepaid.views.DeviceCoverage', {});
    			me.deviceCoverageRecord = Ext.ModelMgr.create({}, 'DeviceCoverage');
    			me.deviceCoverage.getForm().loadRecord(me.deviceCoverageRecord);
    			
    			me.wizard = Ext.create('CsgPrepaid.views.Wizard', {
    				items: me.deviceCoverage
    			});
    			
    			app.viewport.add(me.wizard);
    			
    			var nextButton = me.nextButton = me.wizard.wizardButtons.nextButton;
    			me.backButton = me.wizard.wizardButtons.backButton;
    			
    			nextButton.setDisabled(true);
    			
    			nextButton.on('click', me.nextHandler, me);
    			me.backButton.on('click', me.backHandler, me);
    			
    			me.deviceCoverage.viewCoverageButton.on('click', me.viewCoverageHandler, me);
    		}
    
    		me.backButton.setDisabled(true);
    		nextButton.setText('[View Products]');
    		
        },

  8. #28
    Sencha User
    Join Date
    Feb 2011
    Posts
    106
    Vote Rating
    2
    wizkid is on a distinguished road

      0  

    Default


    Quote Originally Posted by estesbubba View Post
    You guys doing a Form.markInvalid and getting it to display errors on the form? Mine is not. Debugging shows there are errors but no red squigglies...

    PHP Code:
            this.deviceCoverage.getForm().updateRecord(this.deviceCoverageRecord);
            var 
    errors this.deviceCoverageRecord.validate();
            if (!
    errors.isValid()) {
                
    this.deviceCoverage.getForm().markInvalid(errors);
                return;
            } 
    There is definitely a bug going on here... See my post / fix here:http://www.sencha.com/forum/showthre...n-error-object
    Last edited by wizkid; 10 Mar 2011 at 5:12 PM. Reason: Spelling error

  9. #29
    Ext JS Premium Member skullbooks's Avatar
    Join Date
    Nov 2010
    Location
    Dillenburg, Hessen, Germany
    Posts
    35
    Vote Rating
    1
    skullbooks is on a distinguished road

      0  

    Default


    hey,

    we have the same problem and want the form to validate by a given model and it's validations.

    now i wrote my own ux.form.ModelValidatedPanel and ux.form.ModelValidatedBasic class that do this for me.

    see here: http://www.diloc.de/blog/2011/05/05/...model-binding/

    the main aim of the form is to hold a model-record what can validate by the model validations and give the error back to the form. and all this by behaving hopefully nearly the same like a normal Ext.form.Panel (validitychange etc.)

    haven't tested it in our whole application context but my simple form example tests worked really fine.

  10. #30
    Sencha User
    Join Date
    Feb 2011
    Posts
    106
    Vote Rating
    2
    wizkid is on a distinguished road

      0  

    Default


    I did something similar but I like yours allot better! I will have to give it a try! Thanks!

Similar Threads

  1. Replies: 5
    Last Post: 15 May 2012, 8:06 PM
  2. Form Binding to BeanModel
    By zathril in forum Ext GWT: Discussion
    Replies: 0
    Last Post: 28 Mar 2010, 1:08 PM
  3. Form binding / update model
    By tsegismont in forum Ext GWT: Help & Discussion (1.x)
    Replies: 0
    Last Post: 2 Apr 2009, 1:22 AM
  4. Form binding
    By exo in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 16 Apr 2007, 4:20 AM

Thread Participants: 19

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar