1. #1
    Sencha User
    Join Date
    Sep 2009
    Posts
    11
    Vote Rating
    0
    hectormendozao is on a distinguished road

      0  

    Default form.load({params: foo:'bar'}) sends data as null

    form.load({params: foo:'bar'}) sends data as null


    Hello,

    I have a form where I need to load the data from a Direct call, form is configured with the api for load and submit.

    When I call
    Code:
    form.load({
         params: {
                foo:'bar'
         }
    });
    The data sent over the wire is:
    Code:
    {"action":"Profile","method":"getData","data":[null],"type":"rpc","tid":16}
    if I call it direct like:

    Code:
    Profile.getData({
         params: {
                foo:'bar'
         }
    });
    the data sent over the wire is:
    Code:
    {"action":"Profile","method":"getData","data":[{"params":{"foo":"bar"}}],"type":"rpc","tid":8}
    I rather use the form load and form submit methods instead of calling directly the direct fn. Any ideas why the form.load method doesn't send any data?

  2. #2
    Sencha User
    Join Date
    Sep 2012
    Posts
    3
    Vote Rating
    0
    mrozatti is on a distinguished road

      0  

    Default Direct data param problem

    Direct data param problem


    Hi,

    I'm having a similar problem here.
    I'm trying to send a form, but data is been set as [undefined]
    Have you solved the problem?

    Tnks in advance.

    I'm using architect to do this.

    here the json data


    {"action":"QueryDatabase","method":"frmHandler_cadastrarAnalista","data":[undefined],"type":"rpc","tid":3}
    my form

    <code>
    xtype: 'form',
    id: 'form_analista',
    layout: {
    type: 'auto'
    },
    bodyPadding: 10,
    title: '',
    api: {submit: QueryDatabase.frmHandler_cadastrarAnalista},
    method: 'POST',
    items: [
    {
    xtype: 'textfield',
    margin: '5 0 5 0',
    width: 453,
    name: 'nome',
    fieldLabel: 'Nome:'
    },
    {
    xtype: 'textfield',
    margin: '5 0 5 0',
    name: 'usuario',
    fieldLabel: 'Usuário:'
    }
    ]
    },
    {
    xtype: 'button',
    handler: function(button, event) {
    var form = Ext.getCmp("form_analista").getForm();
    if (form.isValid()){
    form.submit({
    success: function(form, action){
    Ext.Msg.alert("GO");
    Ext.Msg.alert('Success', action.result.msg);
    },
    failure: function(form, action){
    Ext.Msg.alert("DONT GO");
    Ext.Msg.alert('Failure', action.result.msg);
    }
    });
    }else{
    Ext.Msg.alert('INVALID');
    }
    },
    itemId: 'bt_salvar_analista',
    text: 'Salvar'
    }
    ]
    </code>

  3. #3
    Sencha User
    Join Date
    Sep 2009
    Posts
    11
    Vote Rating
    0
    hectormendozao is on a distinguished road

      0  

    Default solved

    solved


    Yes I was able to solve it....

    There where two things I changed, on the form I included the paramsashash option in architect and also changed the direct object on the server, the problem is in the number of parameters you declare the function has, I was declaring 5 since the query has query, start, end, total and another parameter I don't have on my head right now.

    I noticed the parameters where sent in one parameter as an array so I changed it to 1 parameter and everything started working... I haven't switched off the params as hash option to see if it still works but hey, it's working now, I don't want to mess with it....

    If you need more help, please don't hassitate to contact me.

  4. #4
    Sencha User
    Join Date
    Sep 2012
    Posts
    3
    Vote Rating
    0
    mrozatti is on a distinguished road

      0  

    Default thanks for the response

    thanks for the response


    A tried to set the paramsAsHash true.
    My method already has one param (params)
    It didnt work..

    Could you post you config.php file and your form code?

    thank you again

  5. #5
    Ext JS Premium Member
    Join Date
    May 2009
    Location
    Barcelona (Spain)
    Posts
    218
    Vote Rating
    19
    pagullo will become famous soon enough pagullo will become famous soon enough

      0  

    Default


    Hi!

    Just wanted to tell that this is how ExtJs works, not a bug or some "DJN-thing": use paramsAsHash to true to pass an object -via a single param. When false, it passes params independently.

    ExtJs is very flexible to acomodate many different server side languages, and that makes javascript side configuration more difficult.
    Pedro Agulló, Barcelona (Spain)
    Agile team building, consulting, training & development
    DirectJNgine: http://code.google.com/p/directjngine - Log4js-ext: http://www.softwarementors.com/projects/p/log4js-ext/

  6. #6
    Sencha User
    Join Date
    Sep 2009
    Posts
    11
    Vote Rating
    0
    hectormendozao is on a distinguished road

      0  

    Default


    I agree... in my case it was disappointing because it was neither my first app, nor my first method in the app, so getting that error it was VERY odd... and from that point on, if I didn't specify formHandler I could not send more than one argument to direct.... maybe too many direct calls, objects, definitions, I don't know, but that after 2 complete days messing around solved my problem....

    I will post the code tomorrow mrozatti... I haven't been to the office where I have the code...

    Hector

  7. #7
    Sencha User
    Join Date
    Sep 2012
    Posts
    3
    Vote Rating
    0
    mrozatti is on a distinguished road

      0  

    Default


    Hi Hector.

    Can you post the code? I haven't solved the problem yet.
    My problem is a bit different, the DATA node is showing [undefined] instead of [null] in the json result, but i´m defining it in the Action Class (on router). Some how the data fields of the form are not being send.

    this is the form handler code:

    var form = Ext.getCmp("form_analista").getForm();
    if (form.isValid()){
    form.submit({
    success: function(form, action){
    Ext.Msg.alert('Success', action.result.msg);
    },
    failure: function(form, action){
    Ext.Msg.alert('Failure', action.result.msg);
    }
    });
    }else{
    Ext.Msg.alert('INVALID');
    }
    on firebug console I can see the Json result like this:

    {"action":"QueryDatabase","method":"frmHandler_cadastrarAnalista","data":[undefined],"type":"rpc","tid":1}
    thank you.

  8. #8
    Sencha User
    Join Date
    Sep 2009
    Posts
    11
    Vote Rating
    0
    hectormendozao is on a distinguished road

      0  

    Default


    Sorry for the late response, but it was a holliday here in Mexico....

    Here is my code in the router config:

    Code:
    'cProc'=>array(
           'len'=>1
    ),
    Code in the php declaration:

    PHP Code:
    public function cProc($form) {
    .......

    Ext JS was here is the declaration:

    Code:
    form.load();
    And the error was sent when calling the load() function of the store.....

    Héctor

  9. #9
    Sencha User
    Join Date
    Sep 2009
    Posts
    11
    Vote Rating
    0
    hectormendozao is on a distinguished road

      0  

    Default


    Post a little more code regarding your declaration in the Direct config file, mabye it's there

    Héctor

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar