Editor data submission
Editor data submission
wbyers
Posts: 48Questions: 12Answers: 1
can I submit another string variable instead of action to the server using the editor?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Yes, you can use
preSubmit
to modify the data that is being sent to the server.Allan
Okay, Sorry to bother you on this again, But i've tried to send other strings to my server component using action specifically editStock and editHeld. They don't work. The default action is still sent. Is there anything I have to do with the presubmit event to make it change the action/task. Or is that Locked in?
Can you show me the code you were trying to use please?
Allan
sure:
editor.on('preSubmit', function( e, data, action ){
console.log(data.data);
console.log(action);
I see - thanks. You could use
initSubmit
to change the action, but since Editor needs to understand the variable internally, you can't change it to any old random string (it wouldn't know what yo do witheditStock
for example.Instead, what you would need to do in this case is add another parameter which would contain your custom value.
Allan
wait so I can just add a third element to the function for initSubmit?
No, but you can do:
Allan
Okay, thanks that helps a lot.
so on the server end that would be $_POST['data']['customAction'] right?
Just
$_POST['customAction']
would get it.Allan
Thanks.