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

      0  

    Default Empty value of form field after submit

    Empty value of form field after submit


    In fp = new Ext.FormPanel i have this:

    Code:
    {
                xtype: 'hidden',
                id: 'flat_id',
                name: 'flat_id',
                value: ''     
    }
    also I have Save button:

    Code:
    buttons: {
                text: 'Save',
                id: 'saveBtn',
                disabled: true,
                handler: function(){
                    if(fp.getForm().isValid()){
                      Ext.getCmp('flat_id').value = Grid.getSelectionModel().selections.keys[0];
                      console.log("success on %o", fp.getForm().items);
    	                fp.getForm().submit({
    	                    url: 'upload.php',
    	                    success: function(fp, o){
    	                        imgds.reload();
    	                    }
    	                });
                    }
                }
            }
    In console.log I see right current value of grid row index
    But in POST I see empty flat_id

    Is this bug or my fault?

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Setting a property of a Javascript object will not affect the contents of an HTML input field.

  3. #3
    Ext User
    Join Date
    Jun 2007
    Posts
    10
    Vote Rating
    0
    z1nkum is on a distinguished road

      0  

    Default


    Quote Originally Posted by Animal View Post
    Setting a property of a Javascript object will not affect the contents of an HTML input field.
    OMG! Thanks!

    Solution:

    Code:
    Ext.getCmp('flat_id').value = Grid.getSelectionModel().selections.keys[0];
    
    to
    
    document.getElementById('flat_id').value = Grid.getSelectionModel().selections.keys[0];

  4. #4
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    Yes, that's one of the many ways to skin this cat!

Thread Participants: 1