Results 1 to 6 of 6

Thread: Button disable before page submit

  1. #1
    Sencha User
    Join Date
    Sep 2008
    Posts
    46

    Default Button disable before page submit

    Hi,

    I have a grid that has a save button. Grid is populated with json data. On click of save, I am setting the json data into a hidden form field and then submitting the form. If the json data is too large, the setting of hidden form field takes some time and during that period it appears as if the page is frozen. In order to let the user know that the save button click has already been fired, I was trying to disable the save button on click of save. I am adding the code to disable the button before setting json data to hidden field. However the button does not get disabled till the page is submitted. What could be the reason for this? Is there a workaround?

    Code:
     
    { 
       text: 'Save', 
       id: 'saveBtn',
       handler: function() {
        Ext.getCmp('saveBtn').disable();
        document.getElementById('dataList').value=Ext.util.JSON.encode(results.censusRoot);
        document.jsonForm.action ='censusUpload.do?census_action=save';
        document.jsonForm.submit();
      } 
    }
    Last edited by ajain; 24 Apr 2009 at 5:55 AM. Reason: change

  2. #2
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    why disable the button if you're doing a plain'ol submit?

  3. #3

  4. #4
    Sencha User
    Join Date
    Sep 2008
    Posts
    46

    Default

    Like I said, between the time the json data is getting populated in the hidden field and the page is submitted, the page seems to do nothing and it feels like the page has hung. So I wanted to either disable the save button or mask the page to let the user know that the request to save has already been invoked.

  5. #5
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364

    Default

    how about deferring the execution of the population of the hidden field by 100ms. give the UI time to update.

  6. #6
    Sencha User
    Join Date
    Sep 2008
    Posts
    46

    Default

    Worked, thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •