Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

Forcing a Field to a Specific Format

Quote Reply
Forcing a Field to a Specific Format
I have a phone number and fax number field within my database. People will enter all of the following formats:

(xxx) xxx-xxxx
xxx-xxx-xxxx
xxx xxx xxxx
xxx xxx-xxxx

Is there any way to take any data input into these fields and force it to my desired format of xxx-xxx-xxxx (as long as it has 10 digits)?

Thanks.

Quote Reply
Re: Forcing a Field to a Specific Format In reply to
If memory serves me correct, there were regular expression codes provided for Phone Numbers about four months ago in the DBMAN Customization Forum. All you have to do is add the regular expressions in the valid expressions column in your Links.def and Validate.def files and in your Links and Validate tables.

Regards,

Eliot Lee

Quote Reply
Re: Forcing a Field to a Specific Format In reply to
Hi,

Thanks, but I could not locate the thread. How exactly do I add the valid expressions for, say, xxx-xxx-xxxx?

Quote Reply
Re: Forcing a Field to a Specific Format In reply to
Read the following Thread:

http://gossamer-threads.com/...=&vc=1#Post10019

All you have to do is add the following in the valid expressions
column in the Links.def and Validate.def files, and
the Links and Validate tables:

Code:

'^\d{3}\d{3}\d{4}'


Like the following in the .def files:

Code:
Phone Number => ['8', 'CHAR', '40', '50', '0', '', '^\d{3}\d{3}\d{4}'],
All I did was use the following search criteria:

Keywords: phone numbers
Forum: DBMAN Customization Forum
Matches: And
Date Range: All posts

Regards,

Eliot