1. #1
    Ext User
    Join Date
    Jun 2007
    Posts
    1
    Vote Rating
    0
    digiboy21c is on a distinguished road

      0  

    Default [2.0??] FormPanel.getForm().setValues() not working...

    [2.0??] FormPanel.getForm().setValues() not working...


    I'm having an issue with trying to call setValues on a FormPanels form object. I created a FormPanel and dynamically added some text fields to it with the add() method. The text fields that i was adding were created by applying to an existing DOM element.

    The problem I am seeing is that the setValues isn't setting the values. I dug a little deeper and it looks like the add() method for a FormPanel does not add the form elements to the underlying BasicForm object. The setValues() method tries to apply the values to the underlying BasicForm object but since the form elements weren't added.. they couldnt' be applied.

    Question is.. is this a bug? Or do i need to call something else in order for the form elements to be added to the FormPanel's underlying BasicForm? or is there another way to set values on a FormPanel?

    Thanks in advance,
    Kevin
    Last edited by mystix; 29 Jan 2008 at 1:35 AM. Reason: moved to 2.x Bugs from 1.x Bugs

  2. #2
    Ext User
    Join Date
    Jan 2008
    Posts
    21
    Vote Rating
    0
    cheek is on a distinguished road

      0  

    Default


    Hi,
    I'm a Ext newbie, but maybe I can help a little.

    I think the FormPanel Component does not have any method linke setValues

    I don't know if u can use it like that if u want to create the form elements dynamically, but
    u have to create the form elements first (where u can set the default values) and then u have to create the FormPanel with these Elements/Items like:

    PHP Code:

    var firstname = new Ext.form.TextField({
            
    fieldLabel'firstname',
            
    allowBlanktrue,
            
    name'name',
            
    height20,
            
    blankText'Enter name',
            
    anchor'90%',
            
    id'firstname',
            
    maxLength20,
            
    value'blubb'            // <- here u can set the initial value
            
             
        
    });
        
        var 
    lastname = new Ext.form.TextField({
            
    fieldLabel'lastname',
            
    allowBlanktrue,
            
    name'lastname',
            
    anchor'90%',
            
    id'lastname',
            
    maxLength30,
            
    value'type in lastname'
        
    });


    var 
    formPanel = new Ext.form.FormPanel({
      
            
    baseCls'x-plain',    // base css file
            
    labelWidth75,

            
    autoScrolltrue,
            
    defaultType'textfield',   // The default type of container represented by this object as registered in Ext.ComponentMgr (defaults to 'panel').

            
    items: [
            
    firstname,
            
    lastname
            
    ]
     }); 
    Hope that will help and sorry 4 my english

  3. #3
    Ext User cerad's Avatar
    Join Date
    Dec 2007
    Posts
    226
    Vote Rating
    0
    cerad is on a distinguished road

      0  

    Default


    As cheek says there is no formPanel.setValues() method. I'm assuming you are using formPanel.form.setValues()? Likewise you should be using formPanel.form.add() to add elements to the form.

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,400
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    There was a change between 2.0 and 2.0.1 in which fields dynamically added to a FormPanel at runtime will be added to their underlying BasicForm. Upgrade to 2.0.1 and see if this resolves your issue.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Ext User cerad's Avatar
    Join Date
    Dec 2007
    Posts
    226
    Vote Rating
    0
    cerad is on a distinguished road

      0  

    Default


    Is the online documentation 2.0.0 or 2.0.1? Is there a way to tell?

    I know it's a bit off topic but the current documentation does not reflect this add() change.

    I suppose I should start serving the docs from my own local server so I would always know for sure but I was kind of hoping to avoid that.

  6. #6
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,400
    Vote Rating
    129
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    The bug fix is mentioned in the release notes. The online documentation is 2.0.1. We should look into a way to denote the versioning very easily - either by changing the title or putting something prominent on the the Home tab. At this point the easiest way is to simply check the header of one of the Ext files deployed with the docs.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  7. #7
    Ext User wolverline's Avatar
    Join Date
    Oct 2008
    Location
    Timbuktu, Mali
    Posts
    11
    Vote Rating
    0
    wolverline is on a distinguished road

      0  

    Default


    Quote Originally Posted by aconran View Post
    The bug fix is mentioned in the release notes. The online documentation is 2.0.1. We should look into a way to denote the versioning very easily - either by changing the title or putting something prominent on the the Home tab. At this point the easiest way is to simply check the header of one of the Ext files deployed with the docs.
    I don't understand what you mean.. I don't see any change note for this issue.