Hello community, i have create a custom app in freshsales suite that display a form whenever a button is clicked i need to save the data that the user enter in the form can someone help me doing this (my form is created with crayon)
Hey @mehdi,
With Crayons forms, there is a method called doSumit()
or you can also use the JS to define the click action for submit button.
document.querySelector('#submit').addEventListener('click', async (e) => {
const { values, isValid } = await form.doSubmit(e);
console.log({ values, isValid });
if (isValid) {
// make ajax post end point with values
// fetch("/post",values);
// if error from backend , set Errors - passing key value pair
// set Errors on the form
form.setFieldErrors({
first_name: 'First Name must be unique <<Server Error>>',
});
// reset the form if required if success
// formRef.current.doReset(e);
}
});
hello @zach_jones_noel ,
can you tell me wich API should i use to save the input field data ?
it is create custom field API?
Thanks!