Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Formpanel to PHP

  1. #1
    Sencha User
    Join Date
    Jul 2008
    Posts
    49

    Default Formpanel to PHP

    Hai, I have a ridicoulous problem but I can't find the solution

    I have a FormPanel which submits data to a PHP page with a "myform.getForm.submit()"

    I manage to make the PHP page send a message to the server that the ajax submit was successful with an "echo {success: true}"

    but I can not figure out how to access the data sent by the Formpanel in the php page.

    $_POST and $_GET do not seem to work

    The only example that I can find on this site is in an apparently corrupted zip file.

    could someone spare a minute to point this clumsy newbie to a working example?

  2. #2
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    "myForm.getForm.submit()" won't actually submit anything (It will throw a javascript error) , so I'm not sure I believe you that you are getting your PHP server to see anything,.

    Submitting a form submits in a perfectly normal format with HTTP parameters.

  3. #3
    Sencha User
    Join Date
    Jul 2008
    Posts
    49

    Default

    the whole story looks like this:

    var storyform = new Ext.FormPanel({
    url: 'controller.php?cdrv=3',
    layout: 'form',
    bodyStyle:'padding:2px;',
    tbar: [{
    text: 'Save',
    handler: function() {
    storyform.getForm().submit ({
    waitMsg:'Sending data to server...',
    success: function(f,a) {
    Ext.Msg.alert('success', 'Data succesfully sent');
    storyform.getForm().reset();
    },
    failure: function (f,a) {
    Ext.Msg.alert('Warning', 'error');
    }
    });
    }
    },{
    text: 'Reset',
    handler: function() {
    storyform.getForm().reset();
    }
    }],
    items: [{
    xtype: 'textfield',
    fieldLabel: 'Title',
    name: 'title'
    },{
    xtype: 'textfield',
    fieldLabel: 'Summary',
    name: 'summary'
    },{
    xtype: 'htmleditor', // should be htmleditor, only for testing purposes
    id: 'bulk',
    fieldLabel: 'Bulk',
    name: 'bulk',
    defaultValue: 'enter your text here',
    height: 300,
    anchor: '98%'

    }]
    });

    then I have a toolbar in a window which opens the storyform


    tbar: [{
    text: 'New story', // introducing a new family story
    handler: function () {
    var storyformwindow = new Ext.Window ({
    layout: 'fit',
    plain:true,
    title: 'New story',
    width: 600,
    closable: true,
    closeAction:'hide',
    items: storyform
    });
    storyformwindow.show()
    }
    }],


    Now, when i click on the submit button i first get the 'sending data to server' message

    and a bit later, after the server (the php page "controller.php?cdrv=3") has answered with the {success: true} echo I reccieve the alert 'data successfully sent'

    From this I think that the content of the formpanel is actually sent to the server.

    What I can't find is how the php page can access the received info.

    I find a lot of info on this site how to send data to the server, but absolutely nothing how a php page on the server can access that data and do something with it

  4. #4
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676

    Default

    please edit your post and use code boxes!
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  5. #5
    Sencha User
    Join Date
    Jul 2008
    Posts
    49

    Default

    if i would know what code boxes are i would most cetainly do so :-((

  6. #6
    Sencha User
    Join Date
    Jul 2008
    Posts
    49

    Default

    Quote Originally Posted by drabslab View Post
    the whole story looks like this:



    Code:
     
     
     
     
    
    var storyform = new Ext.FormPanel({
    Code:
     
    
    url: 'controller.php?cdrv=3',
    layout: 'form',
    bodyStyle:'padding:2px;',
    tbar: [{
    text: 'Save',
    handler: function() {
    storyform.getForm().submit ({
    waitMsg:'Sending data to server...',
    success: function(f,a) {
    Ext.Msg.alert('success', 'Data succesfully sent');
    storyform.getForm().reset();
    },
    failure: function (f,a) {
    Ext.Msg.alert('Warning', 'error');
    }
    });
    }
    },{
    text: 'Reset',
    handler: function() {
    storyform.getForm().reset();
    }
    }],
    items: [{
    xtype: 'textfield',
    fieldLabel: 'Title',
    name: 'title'
    },{
    xtype: 'textfield',
    fieldLabel: 'Summary',
    name: 'summary'
    },{
    xtype: 'htmleditor', // should be htmleditor, only for testing purposes
    id: 'bulk',
    fieldLabel: 'Bulk',
    name: 'bulk',
    defaultValue: 'enter your text here',
    height: 300,
    anchor: '98%'
    }]
    });
    then I have a toolbar in a window which opens the storyform




    Code:
     
     
     
     
    
    tbar: [{
    text: 'New story', // introducing a new family story
    handler: function () {
    var storyformwindow = new Ext.Window ({
    layout: 'fit',
    plain:true,
    title: 'New story',
    width: 600,
    closable: true,
    closeAction:'hide',
    items: storyform
    });
    storyformwindow.show() } }],
    Now, when i click on the submit button i first get the 'sending data to server' message

    and a bit later, after the server (the php page "controller.php?cdrv=3") has answered with the {success: true} echo I reccieve the alert 'data successfully sent'

    From this I think that the content of the formpanel is actually sent to the server.

    What I can't find is how the php page can access the received info.

    I find a lot of info on this site how to send data to the server, but absolutely nothing how a php page on the server can access that data and do something with it
    b

  7. #7
    Sencha User
    Join Date
    Jul 2008
    Posts
    49

    Default

    Quote Originally Posted by steffenk View Post
    please edit your post and use code boxes!
    I honestly tried to give my post a good layout using the buttons above the input field but it does not work, yet another problem

  8. #8
    Sencha Premium Member steffenk's Avatar
    Join Date
    Jul 2007
    Location
    Haan, Germany
    Posts
    2,676

    Default

    wrong button! use #, result: [ code]...[ /code]
    vg Steffen
    --------------------------------------
    Release Manager of TYPO3 4.5

  9. #9
    Sencha User
    Join Date
    Jul 2008
    Posts
    49

    Default

    thanks, i tried, it is slightly better

    i do not think that the problem is in the ext code, i just do nto know what i have to do on the receiving end withPHP

    I thought that i could get to the sent data by using (as example)

    $test = $_POST('summary');

    but as soon as i do that I get an 7636 syntax error in the browser

  10. #10
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    In the browser?

    You are supposed to be submitting data and processing it on the server in the normal PHP way.

    There is no such thing as a "7636" error.

    Your PHP is wrong.

Page 1 of 2 12 LastLast

Posting Permissions

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