1. #1
    Ext User
    Join Date
    Apr 2008
    Posts
    2
    Vote Rating
    0
    Skippdog is on a distinguished road

      0  

    Default HTML form in TabPanel. How do I submit that form and load the response in the tab?

    HTML form in TabPanel. How do I submit that form and load the response in the tab?


    Hey All,

    New to Ext, but have been picking it up very quickly due to how logically predictable everything is laid out. There's one thing that's been hurting my brain for the past few hours, though.

    I'm on a tight deadline with a particular project and unfortunately don't have the time to refactor all my working and server-side validating forms to JSON, so what I've done is loaded the HTML forms into individual TabPanels using autoLoad. They render fine, but now I'd like to have it so the form submission is sent via an AJAX request and the results get loaded back into the tab (to show validation errors, or success messages).

    I've tried attaching a BasicForm to my existing HTML form - this disables the default form submit, but I'm stuck from there. I can't find a way to submit a form via AJAX that isn't built via script. Is this even possible?

    Hoping someone can point me in the right direction!

  2. #2
    Sencha - Training Team RWaters's Avatar
    Join Date
    Mar 2007
    Location
    Los Angeles, CA
    Posts
    714
    Vote Rating
    0
    RWaters is on a distinguished road

      0  

    Default


    You can certainly whip up a custom Ajax call -
    Code:
    Ext.Ajax.request({
      url: 'somewhere.php',
      params: Ext.Ajax.serializeForm('myform'),
      success: function(res, req) {
        var panel = Ext.getCmp('yourPanelId');
        panel.body.innerHTML = res.responseText;
      }
    })

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    2
    Vote Rating
    0
    Skippdog is on a distinguished road

      0  

    Default


    Ah ha! I was coming at it from the totally wrong direction.

    That serializeForm function totally saved the day for me! I ended up using getUpdater from my Tabpanel to get my update manager and simply used that to refresh the tab and pass in the params from serializeForm. Works like a charm now!

    Thanks so much!

  4. #4
    Sencha - Training Team RWaters's Avatar
    Join Date
    Mar 2007
    Location
    Los Angeles, CA
    Posts
    714
    Vote Rating
    0
    RWaters is on a distinguished road

      0  

    Default


    Yeah, updater is probably an even cleaner way to go since you're putting the content straight into the panel.

    Glad I could help.

  5. #5
    Sencha - Community Support Team jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    81
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default


    Rich,
    i tried to PM you -

    RWaters has exceeded their stored private messages quota and can not accept further messages until they clear some space.


    Also, your sig has double http:// in the link.

    Sorry for the threadjack.