How to work with jquery custom validation for hubspot form
SOLVE
How to work with jquery custom validation for hubspot form
I want form field email and website belongs to same domain for e.g email - nutan@xtensible.in and website - www.xtensible.in
So want to validate it with custom validation
Jun 29, 202111:53 AM - edited Jun 29, 202111:57 AM
Participant
How to work with jquery custom validation for hubspot form
SOLVE
Hello everyone. I'am currently able to add custom validation to hubspot forms using the event "onFormReady" and the lib jquery-validate.
The key is to prevent the submit button to submit if the form is not valid. To do that I add this click event :
jqueryForm.find('input[type="submit"]').click((e) => {
if (!jqueryForm.valid()) {
e.preventDefault();
}
});
I hope this can help. I also hope the hubspot team will not add a breaking change because adding custom validation is very important for us. We need it for email and phone number.
How to work with jquery custom validation for hubspot form
SOLVE
Hi ACourdille,
I've tried to follow your suggestion of using onFormReady and the jquery-validate library, but still can't seem to make it work 😕 It still submits regardless. Would you mind sharing some more of your code, so I can see what I'm missing?