Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    POSTPARAMS vs GETPARAMS - DS Protocol

    Hello, I am trying to build a restdatasource as I slowly get the hang of this. One problem I have right now is GETPARAMS and POSTPARAMS. I wanted to use POST so I could get the info via the PHP script, but when I do, I only seem to be able to retrieve the data using the $_GET global. I dont seem to get anything when changing it to $_POST.


    RestDataSource noteAddDS = new RestDataSource();
    noteAddDS.setDataURL("noteadd.php");

    OperationBinding add = new OperationBinding();
    add.setOperationType(DSOperationType.ADD);
    add.setDataProtocol(DSProtocol.POSTPARAMS);

    noteAddDS.setOperationBindings(add);

    DataSourceTextField addNote = new DataSourceTextField("text", "text");


    TextAreaItem noteArea = new TextAreaItem("text","Enter Notes and Click Submit");
    noteAddDS.setFields(addNote);

    final DynamicForm notesAddForm = new DynamicForm();
    notesAddForm.setDataSource(noteAddDS);
    notesAddForm.setFields(noteArea);

    Button noteSubmit = new Button("Add Note");
    noteSubmit.setAlign(Alignment.CENTER);
    noteSubmit.addClickHandler(new ClickHandler() {
    public void onClick(ClickEvent event) {
    notesAddForm.submit();
    }
    });


    $_GET[text] works fine but $_POST[text] doesnt seem to pull in anything.

    What am I doing wrong here?

    #2
    Use firebug, and you can see what client send to server
    Originally posted by tpabrad
    Hello, I am trying to build a restdatasource as I slowly get the hang of this. One problem I have right now is GETPARAMS and POSTPARAMS. I wanted to use POST so I could get the info via the PHP script, but when I do, I only seem to be able to retrieve the data using the $_GET global. I dont seem to get anything when changing it to $_POST.


    RestDataSource noteAddDS = new RestDataSource();
    noteAddDS.setDataURL("noteadd.php");

    OperationBinding add = new OperationBinding();
    add.setOperationType(DSOperationType.ADD);
    add.setDataProtocol(DSProtocol.POSTPARAMS);

    noteAddDS.setOperationBindings(add);

    DataSourceTextField addNote = new DataSourceTextField("text", "text");


    TextAreaItem noteArea = new TextAreaItem("text","Enter Notes and Click Submit");
    noteAddDS.setFields(addNote);

    final DynamicForm notesAddForm = new DynamicForm();
    notesAddForm.setDataSource(noteAddDS);
    notesAddForm.setFields(noteArea);

    Button noteSubmit = new Button("Add Note");
    noteSubmit.setAlign(Alignment.CENTER);
    noteSubmit.addClickHandler(new ClickHandler() {
    public void onClick(ClickEvent event) {
    notesAddForm.submit();
    }
    });


    $_GET[text] works fine but $_POST[text] doesnt seem to pull in anything.

    What am I doing wrong here?

    Comment


      #3
      Thanks adder, that helps alot. Wasnt seeing it at first in firebug but after clicking on a few things I started seeing all of the GET requests, now just to find out why they arent post, I must be confused at what POSTPARAMS means.

      Comment


        #4
        I cant find any examples that show how to submit a form. Any pointers in that may help me get to where I need to be. When I call submit or saveData, it seems to call nothing, instead of the script Ive got set.

        Comment

        Working...
        X