Form Field Validation Bugs

Support forumForm Field Validation Bugs
KELBY asked 4 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 Staff answered 3 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 3 years ago
Hi pradev, can you please paste the screenshot link to that issue? Best regards, Nikola
pradev Staff replied 3 years ago

Sure, here you check out:

pradev Staff replied 3 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:

Nikola Loncar Staff answered 3 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 Staff replied 3 years ago

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

Nikola Loncar Staff replied 3 years ago

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