CMS Development

DanBQ
Participant | Partenaire solutions Elite
Participant | Partenaire solutions Elite

Form is showing message "PLEASE COMPLETE THIS REQUIRED FIELD" on page load

Résolue

Hi all,

 

We have a problem with the form on this page https://oni.bio/contact

 

When the first name is set as a required field the message "PLEASE COMPLETE THIS REQUIRED FIELD" displays straight away underneath the form field, even when the field hasn't been activated.

 

It's strange because the email required field works fine.

 

It seems to be a javascript issue but I'm not sure how to resolve the issue.

 

Any help is much appreciated!

0 Votes
1 Solution acceptée
tjoyce
Solution
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

Form is showing message "PLEASE COMPLETE THIS REQUIRED FIELD" on page load

Résolue

@DanBQ -

I suspect it's the code in this file https://oni.bio/assets/js/hub-spot-60481bcb94.js#

$('input[name="firstname"]').val('').change();

Can you comment that line out and let us know if the form first name field is prefilled with some sort of values.

I think what's happening is this:

There is a value and your code is doing a focus and blur event on form load. This might not affect the email field because the focus and blur events only trigger the HS error messages if there is a value in the field, you then focus the field, then clear it out, then blur. Since email might be empty, it doesn't follow that pattern.

Voir la solution dans l'envoi d'origine

0 Votes
1 Réponse
tjoyce
Solution
Expert reconnu | Partenaire solutions Elite
Expert reconnu | Partenaire solutions Elite

Form is showing message "PLEASE COMPLETE THIS REQUIRED FIELD" on page load

Résolue

@DanBQ -

I suspect it's the code in this file https://oni.bio/assets/js/hub-spot-60481bcb94.js#

$('input[name="firstname"]').val('').change();

Can you comment that line out and let us know if the form first name field is prefilled with some sort of values.

I think what's happening is this:

There is a value and your code is doing a focus and blur event on form load. This might not affect the email field because the focus and blur events only trigger the HS error messages if there is a value in the field, you then focus the field, then clear it out, then blur. Since email might be empty, it doesn't follow that pattern.

0 Votes