Mautic Community Forums

Handle form data before send

Hello.



I am showing a form by the manual way (HTML form + Javascript). I need to change some data before sending… But how can I do that?



I can execute some action after form validate and before send (that’s what I want – OK) , but I don’t know how to change some parameter.



For example, I want to change the value of my input named

Code:
inputName
on my form
Code:
formName
. Right now, that's what I am doing:
Code:
if (typeof MauticFormCallback == 'undefined') { var MauticFormCallback = {}; } MauticFormCallback['formName'] = { onValidateEnd: function (formValid) { var data = { 'inputName': 'New value!' }; } };

(onValidateEnd documentation)

The
Code:
var data = {}
is just a guess, I don't know how I should determinate the new value and I can't find anything similar on Docs.

Thank you.

Hello.

I am showing a form by the manual way (HTML form + Javascript). I need to change some data before sending… But how can I do that?

I can execute some action after form validate and before send (that’s what I want – OK) , but I don’t know how to change some parameter.

For example, I want to change the value of my input named inputName on my form formName. Right now, that’s what I am doing:

if (typeof MauticFormCallback == 'undefined') { var MauticFormCallback = {}; } MauticFormCallback['formName'] = { onValidateEnd: function (formValid) { var data = { 'inputName': 'New value!' }; } };

(onValidateEnd documentation)

The var data = {} is just a guess, I don’t know how I should determinate the new value and I can’t find anything similar on Docs.

Thank you.