This would be a follow-up of question [A form's “action” and “onsubmit”: Which executes first?][1] where it's concluded that onSubmit runs first, and then the action to submit a form is done.
I would like to compose my onSubmit method to clean up the POST submission that will be sent; is there a way to modify said POST message that will be sent to the server, not by changing the values of the fields, but rather the composition of it?
As an example, my form consists of two fields, name and surname. The submit action ends up sending a POST body like:
name=John&surname=Doe
But I'd like the POST body to be
fullname=John_Doe
I am actually stuck without an idea of how to approach this problem, so any hint on where to look for documentation about this is appreciated - I don't want to leech the code that will do it, but some hint of where to start.
Thanks! [1]: A form's "action" and "onsubmit": Which executes first?_