Phone number field

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.

Phone number field

Postby sagmag » Mon Jan 08, 2018 2:43 am

Is there away to setup a field to receive phone number?
sagmag
 
Posts: 46
Joined: Tue Jul 18, 2017 1:15 pm

Re: Phone number field

Postby sangnandar » Mon Jan 08, 2018 5:23 am

What's the trouble?
Phone number is just an INT datatype, right?
Please explain more.
sangnandar
 
Posts: 296
Joined: Mon Sep 19, 2016 2:04 am

Re: Phone number field

Postby arbei » Mon Jan 08, 2018 1:48 pm

Use text field and use "Regular Expression" as validation in order to make sure the Phone number is in your expected format.
arbei
 
Posts: 1499
Joined: Wed Sep 09, 2015 10:13 am

Re: Phone number field

Postby sagmag » Wed Jan 10, 2018 5:26 am

But where and how will I put the regex so that the validation can be done on client and server. If there is an error on client the red color on the edges of the fields must be shown?
sagmag
 
Posts: 46
Joined: Tue Jul 18, 2017 1:15 pm

Re: Phone number field

Postby arbei » Wed Jan 10, 2018 11:36 am

sagmag wrote:
> But where and how will I put the regex so that the validation can be done
> on client and server. If there is an error on client the red color on the
> edges of the fields must be shown?

1. Enable the option "Client-side (JavaScript)" in [PHP] -> [General Options] -> [Validation].
2. Set up [Edit Tag] of the field as "Text".
3. In [Edit Tag] -> [Validation] -> [Validate] as "Regular Expression".
4. Enter your expression in [Argument (client side)].
5. Enter your error message.

You can also use [Client Script] -> [Form_CustomValidate] of the Edit Page or Add Page to validate the field.
Read help file topic: "Server Events and Client Scripts" -> "Client Scripts" -> "Form_CustomValidate" for more information.
arbei
 
Posts: 1499
Joined: Wed Sep 09, 2015 10:13 am


Return to General Discussion (PHPMaker)