CMS Development

DanBQ
Participante | Parceiro Elite
Participante | Parceiro Elite

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

resolver

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 Avaliação positiva
1 Solução aceita
tjoyce
Solução
Especialista reconhecido(a) | Parceiro Elite
Especialista reconhecido(a) | Parceiro Elite

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

resolver

@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.

Exibir solução no post original

0 Avaliação positiva
1 Resposta 1
tjoyce
Solução
Especialista reconhecido(a) | Parceiro Elite
Especialista reconhecido(a) | Parceiro Elite

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

resolver

@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 Avaliação positiva