preSubmit Uncaught TypeError: Cannot set property of undefined

preSubmit Uncaught TypeError: Cannot set property of undefined

vincmeistervincmeister Posts: 136Questions: 36Answers: 4

Hello Allan,

I'm trying to adapt this example to my case.
I've got error, "Uncaught TypeError: Cannot set property 'p2b_to' of undefined" on preSubmit event on datatables editor.

Here's my test site

My code

P2BHeadEditor.on( 'preSubmit', function ( e, d, type ) {
          if ( type === 'create' || type === 'edit' ) {
            d.data.p2b_head.p2b_to_dept = d.data.p2b_head.p2b_to;
          }
        } );

Please help, thank you

This discussion has been closed.