1. #1
    Sencha User
    Join Date
    Mar 2008
    Posts
    24
    Vote Rating
    0
    michael.piecko is on a distinguished road

      0  

    Default [SOLVED] Forms and Ext Direct

    [SOLVED] Forms and Ext Direct


    Hi all.

    After almost finishing my first Ext app with Ext 2, i make my first steps towards Ext 3 because of the great new Ext Direct feature. There are a lot of REST examples around with grids and forms, but i didn't find any example with a simple no-record form. Just imagine a login form.

    In the last blog there was an example how to setup a form to use Ext Direct http://extjs.com/blog/2009/06/03/ext...t-and-enhanced (last paragraph)

    But this paragraph ends at the most interesting part: how to submit this form using a button and Ext Direct? I didn't succeed with myFormPanel.getForm().submit()? Is this still the way to do it?

    Thans in advance for any hint or example.

    Michael
    Last edited by michael.piecko; 15 Jun 2009 at 6:17 AM. Reason: Solved

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,365
    Vote Rating
    128
    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


    Michael -

    Provide your form an api configuration with a submit action like so:

    Code:
    api: {
       submit: MyFormAction.submit
    }
    Ext will automatically recognize that you are intending to submit your form via Ext.Direct. Now when you do:
    Code:
    myFormPnl.getForm().submit();
    It will automatically submit to your MyFormAction.submit on the server-side. This will be a standard form post and therefore you will need to specify the formHandler attribute in the Ext.Direct stack.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User
    Join Date
    Mar 2008
    Posts
    24
    Vote Rating
    0
    michael.piecko is on a distinguished road

      0  

    Thumbs up


    aconran, i feel ashamed.

    This works perfectly. My api setting was in the Ext.Window config containing the form, not in the Ext.form.FormPanel, where it belongs to. Damn ...

    Michael

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,365
    Vote Rating
    128
    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


    No problem; Glad you got it up and running!
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Ext User
    Join Date
    Jul 2010
    Posts
    23
    Vote Rating
    0
    jai1485 is on a distinguished road

      0  

    Default Please help me!!!!!!

    Please help me!!!!!!


    My question may be silly.
    Please help me out of this issue.
    I am using a form with direct api and trying to insert records in to the db. But form values are not submitting to the server side.
    My Code:
    formadd= new Ext.form.FormPanel({
    // configs for FormPanel
    title: ‘Add record’,
    border: false,
    padding: 10,
    buttons:[{
    text: 'Submit',
    handler: function(){
    formadd.getForm().submit({
    params: {
    foo: 'bar',
    uid: 34
    }
    });
    }
    }],
    defaultType: ‘textfield’,
    items: [{
    fieldLabel: 'Name',
    name: 'name'
    },{
    fieldLabel: 'Email',
    msgTarget: 'side',
    name: 'logo_url'
    }],
    api: {
    // The server-side method to call for load() requests
    load: Vendor.read,
    // The server-side must mark the submit handler as a ‘formHandler’
    submit: Vendor.save
    },
    // specify the order for the passed params
    paramOrder: ['uid', 'foo']
    });
    Please help me!!!!!!!

  6. #6
    Sencha User
    Join Date
    Mar 2010
    Posts
    47
    Vote Rating
    0
    Andrew Peacock is on a distinguished road

      0  

    Default


    See my reply in the other thread you posted to.
    Andy