Alpha numeric validation for text box in join form

Hi All,

  I am having National ID field in the join form, where I need to have a validation over national ID for Spain Country

  Eg: 00000000-A, For this example how can I keep validation for accepting only 8 digits and also accept only one character in the text box.

 Where if user gives below 8 digits, or above 8 digits or not giving character or giving more than one character means it should display error.

Quote · 25 Apr 2014

Hello,

you can place your unique field check in Dolphin admin panel -> builders -> profile fields. Click on the item you have, there is a check textarea in advanced tab. You could try this regular expression:

return (bool)preg_match("/^([0-9]){8}\-\w$/", $arg0);

 

Also you can set a custom error message in "messages -> check error message" to display when this check fires.

Free and premium Dolphin templates. Custom design services.
Quote · 26 Apr 2014

Thanks nuknspax,

 It's works well

Quote · 28 Apr 2014

Hi nuknspax,

If I gave 12345678-9 means it's accepting. But actually I need 12345678-one character(a to z)

Quote · 11 Jul 2014

Change this.

return (bool)preg_match("/^([0-9]){8}\-\w$/", $arg0);

To this to allow only 1 uppercase letter at the end.

return (bool)preg_match("/^([0-9]){8}\-[A-Z]$/", $arg0);

To this to allow only 1 lowercase letter at the end.

return (bool)preg_match("/^([0-9]){8}\-[a-z]$/", $arg0);

Or to this to allow only one upper or lowercase letter at the end.

return (bool)preg_match("/^([0-9]){8}\-[a-zA-Z]$/", $arg0);

https://www.deanbassett.com
Quote · 11 Jul 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.