How to pass values to server onPresubmit

How to pass values to server onPresubmit

INTONEINTONE Posts: 153Questions: 58Answers: 6

Im still not sure how to pass data to the server on presubmit. All my attempts does not work. I can't not find the right documentation. Can someone please help. Here is my code:

  editor.on( 'preSubmit', function ( e, o, a ) {
    if(a === "edit"){

           /*this passes a value to the form element 
           which is visible as the form is processing but it does not go to the database*/
            editor.field('some_field').val('some_value');
       }

   } );

The second parameter is said to be the "The data object that will be submitted to the server" see http://editor.datatables.net/reference/event/preSubmit yet if I do this :

   editor.on( 'preSubmit', function ( e, o, a ) {
    if(a === "edit"){

            o.data.some_column_name = some_column_value
       }

   } );

it does not ever get submitted to the database either. What am I doing wrong?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Your second example should be what would work. If that isn't working for you can you link to a test page showing the issue so I can investigate please?

    Allan

  • INTONEINTONE Posts: 153Questions: 58Answers: 6
    edited July 2014

    I realized I was passing an array to the server instead or an integer. ouput from server:
    [some_column_name] => Array
    (
    [0] => 1
    )

    so I did a simple:
    o.data.some_column_name = parseInt(some_column_value);

This discussion has been closed.