Support forumCategory: BugsForm Field Validation Bugs
KELBY asked 2 years ago

When you set the the custom phone number fields to *required and select just the country code but no phone number in the text field a user can still submit the form causing incomplete data on the backend. Full phone numbers are missing even though the fields are required.
Also when I select the default value to US it reverts to canada even after saving and applying the changes. It always defaults to +1CAD. I have to leave that drop down set to  null “-” because it always defaults back to +1CAD on the front end.
Thank you for any help!

3 Answers
pradev answered 2 years ago

Another Form field validation bug I found is if you have “I agree field” enabled and submit the form with unchecked “I agree” field – the error label is placed into the checkbox label – it gets nested and looks not good.
A solution could be to set “errorPlacement” option when you call this.$element.find(‘form’).validate(); and place the error label outside the checkbox label.
Cheers,

Nikola Loncar Staff answered 2 years ago

Hi pradev, can you please paste the screenshot link to that issue?

Best regards,
Nikola

pradev replied 2 years ago

Sure, here you check out:

https://ibb.co/JKdkRh5

pradev replied 2 years ago

The error label is appended exactly after the checkbox input and before “I agree with…” text. You could avoid this with errorPlacement plugin option.
I could also suggest you to wrap the checkbox text into span element for those people who want to play with css and create beautiful custom checkbox like in the screenshot below:

https://ibb.co/pvh69WK

Nikola Loncar Staff answered 2 years ago

Hi, thanks for reporting we will fix that label issue. Regarding country code number well it forms single field so we can add the something like has to be number with more then 4 digits. Would that be ok for you?

Best regards,
Nikola

pradev replied 2 years ago

You mean to create a separate field for country code? Sounds good.

Nikola Loncar Staff replied 2 years ago

Well it will be required to enter more than 3 numbers there.