Global form events not working

Is there new documenation for global form events? The old documentation is incorrect.

For context, I’m trying to use the onFormSubmit to update hidden values:

onBeforeFormSubmit: (form, vals) => {
 const data = calculateDat();
 vals = [...vals, {name: "type", values: data}];
}

Acc. to the documentation, `form` should be a JQuery object. It’s not.

I’m using Svelte, and don’t want to inject jQuery for one thing.

Is there any way to update a hidden input with some calculated data?

Helllo @CLoder

I don’t believe the callback params have changed, Also these are just callbacks and don’t act as a data modifier before actual submission.

You will have to create a form, add your own logic through javascript and use this API to submit the values: https://legacydocs.hubspot.com/docs/methods/forms/submit_form

If you have any doubts, please do ask

> don’t act as a data modifier before actual submission.

Well that’s a bummer.

the docs give an example:

Examples:
$('input[value="checkbox_1"]').prop('checked', true).change();
$('input[name="firstname"]').val('Brian').change(); 

If not using jQuery:
input.value = value;
input.dispatchEvent(new Event('input', { bubbles: true }));

For Checkboxes:
input.click()

What’s the point of that then? Does it only allow me to update values while the form is rendered?