Custom validation not working
- Bart
- Topic Author
- Offline
- New Member
Less
More
- Posts: 1
- Thank you received: 0
6 years 7 months ago - 6 years 7 months ago #7974
by Bart
In my registration form I use this customer validation code to verify the format of the information provided by the users.
One of the field is now accepting any input while the custom validation should check against this format
/^[A-Z]{6}[0-9]{2}[A-Z]{1}[0-9]{2}[A-Z]{1}[0-9]{3}[A-Z]{1}|[0-9]{11}$/
But another field custom validation is working fine
/^[+]{1}[3]{1}[9]{1}-[3]{1}[0-9]{2}-[0-9]{6,7}|[+]{1}[4]{1}[1]{1}-[7]{1}[6-9]{1}-[0-9]{7}|[+]{1}[4]{1}[2]{1}[1]{1}-[0-9]{3}-[0-9]{7}$/
The only difference I can see between these two fields is the the first one depends on another field.
If I modify the field definition removing the dependency the validation works.
One of the field is now accepting any input while the custom validation should check against this format
/^[A-Z]{6}[0-9]{2}[A-Z]{1}[0-9]{2}[A-Z]{1}[0-9]{3}[A-Z]{1}|[0-9]{11}$/
But another field custom validation is working fine
/^[+]{1}[3]{1}[9]{1}-[3]{1}[0-9]{2}-[0-9]{6,7}|[+]{1}[4]{1}[1]{1}-[7]{1}[6-9]{1}-[0-9]{7}|[+]{1}[4]{1}[2]{1}[1]{1}-[0-9]{3}-[0-9]{7}$/
The only difference I can see between these two fields is the the first one depends on another field.
If I modify the field definition removing the dependency the validation works.
Last Edit: 6 years 7 months ago by Bart.
Please Log in or Create an account to join the conversation.
- Saka
- Offline
- Administrator
6 years 6 months ago #7977
by Saka
Emir Sakic
www.sakic.net
Yes, the client-side validation will not work on dependent fields. It should validate server side though.
Emir Sakic
www.sakic.net
Please Log in or Create an account to join the conversation.