| Post |
|
Guest
| appleo 3:28 pm June 21, 2008
| |
|
|
Please replace the ??? with your data!
[desc]:I am working with a client who specifically wants a phone number (US) to be expressed as: [123]-[123]-[1234]. Presumably this has to be done with one label, and three inputs, stacked horizontally. Easy enough if manually creating a form, but is there any way to do this with cforms? Any other ideas for enforcing proper phone number input?
Overall I find cforms immensely productive. Thanks for the great tool! _
|
|
|
Admin
| Oliver Munich, Germany posts 6237 6:09 pm June 21, 2008
| |
|
|
Why have three input fields and not just one with the above expected input structure? (The field wouldn't validate if not entered as expected)
|
|
|
|
|
Guest
| appleo 10:06 pm June 21, 2008
| |
|
|
OK, that sounds good too. But I can't see how to do one input and maintain the integrity of that particular structure short of a lot of js razzle dazzle. IOW, the field starts as
[ - - ]
and can only have numbers inserted where blanks are, the dashes are permanent fixtures that can't be overwritten. Is that what your suggestion is? Or do we give them a blank field, tell them numbers with dashes in the right place and enforce that after submittal with regexes? But I like my way better ;-) Thx.
|
|
|
Admin
| Oliver Munich, Germany posts 6237 8:12 am June 22, 2008
| |
|
|
the dashes are permanent fixtures that can't be overwritten.
the regexp would ensure that dashed are in place.
I would do it this way:
phone number|[xxx]-[xxx]-[xxxx]|^\\[[0-9]{3}\\]-\\[[0-9]{3}\\]-\\[[0-9]{4}\\]$|title:Please note the required input format!|err:Please enter your phone number in the required way: [xxx]-[xxx]-[xxxx]
|
|
|
|
|
Guest
| appleo 8:01 pm June 22, 2008
| |
|
|
Thanks. I may opt for that. Its a reasonable "compromise".
|
|