Gossamer Forum
Home : Products : DBMan : Installation :

Putting ' - ' in fields?

Quote Reply
Putting ' - ' in fields?
Some of the fields in my database include phone numbers, which most people tend to fill in using the symbol - separating numbers (e.g. 01-8456321) or else they use spaces (e.g. 01 8456321).

The software returns errors when either the space or the dash is entered in a field.

Any ideas how to allow dashes or spaces?

Quote Reply
Re: Putting ' - ' in fields? In reply to
Change the field type to alpha rather than numer.

Regards,

Eliot Lee
Quote Reply
Re: Putting ' - ' in fields? In reply to
That fix won't work for me. In fact I'm surprised I can actually still input numbers (without spaces or dashes) if I've set the fields to 'alpha'??

Quote Reply
Re: Putting ' - ' in fields? In reply to
Uh...alpha field type allows you to add characters not only letters and include numbers.

Regards,

Eliot Lee
Quote Reply
Re: Putting ' - ' in fields? In reply to
So why the error messages with dashes then Eliot?

Quote Reply
Re: Putting ' - ' in fields? In reply to
Anybody got a fix for this? Pleeease....this is the last tweak I need before being able to open the database to the members.

Quote Reply
Re: Putting ' - ' in fields? In reply to
Here is an example from the FAQ noted below regarding using phone numbers.

If you wanted to your phone field to accept:

1-555-555-5555 or 555-555-5555 or 555-5555

Use: '\d{0,1}-?\d{0,3}-?\d{3}-\d{4}$'

Example:

'Telephone' => [10,'alpha',20,15,1,'','\d{0,1}-?\d{0,3}-?\d{3}-\d{4}$'],

If this does not provide the answer, please check the FAQ under the section "Syntax"

Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: Putting ' - ' in fields? In reply to
Thanks Loisc, I tried it but it didn't work. I'm probably doing something wrong, I'll keep trying to understand the syntax and see if I can get it working.

Thanks again.

Quote Reply
Re: Putting ' - ' in fields? In reply to
Got it working! Just fiddled around with the code a while and now it will accet the dash '-' a space and even brackets!!
Thanks for the jump start Loisc. Here's my final version of the line.

'\d{2,3}-?()\d{5,9}$'],