These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Problem with different phone number patterns

Sterre
Registered: Jan 29 2008
Posts: 17

Hello,

I've got a problem with my display and validation pattern for my phone numbers.

In Holland we have two sorts of phone numbers:
Always 10 numbers, but some regions have a 3 digit area code,
other regions a 4 digit area code.

Example:
012-3456789
0123-456789

This is also the way I want my users to enter the data.

I want to display them as followed:
012-3456789 --> 012 - 345 67 89
0123-456789 --> 0123 - 456 789

My display pattern right now is: text{999 - 999 99 99}|text{9999 - 999 999}
My edit pattern is: text{999-9999999}|text{9999-999999}
My validation pattern is: text{999-9999999}|text{9999-999999}
(With a pop-up message to fill in 10 numbers, area code seperated from the rest by a dash, as in the example)

The problem is that the validation works fine, but it always transforms the phonenumber to the first option (999 - 999 99 99).

How can I fix this?

Greetings and thanks in advance,

Sterre

My Product Information:
LiveCycle Designer, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Unfortunately, both your patterns have the same number of digits. I think this may be confusing the Picture Clause parser. You would think that the postion of the first "-" would solve this issue, but it doesn't appear to matter. I'd suggest trying alternate methods of differentiating the two formats. For example, put more of it in the validation clause.


Have you looked up all you're options for building the Picture Clause for display in the Picture Clause Reference?

Get it here:
http://partners.adobe.com/public/developer/en/xml/picture_clause_2.0.pdf

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

Sterre
Registered: Jan 29 2008
Posts: 17
Hi Thomp,

I'm pretty sure that I tried all the possibilities, that are standard. I also have the book "Creating Dynamic Forms with Adobe LiveCycle Designer', and it has the same sort list in it.

Isn't there a way to script it to say if input number 1, then pattern number 1 and if input number 2, then pattern number 2, else give errorwarning box?

I don't know, just saying something.

It is the last problem I have in this form, so anyone who can help me: I'll be very grateful!

Grtz

Sterre
hbella
Registered: Mar 10 2008
Posts: 10
hi there

can someone help me. i want to have the amount on the numeric field
to turn to ($Z,ZZ9.99) so that it can hv an output of R 000,000,00.
on the regionals(cotrol panel) for currency should it be $ or R.
and on the display, validation,data pattern for this field what must it be or
any validation script/pattern message that i should write. i want to know
if all this validations must have " ($Z,ZZ9.99) ".

greetings and regards
hbella
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Sterre,
Have you tried to set the validation pattern and the display pattern to the same values, i.e., force the users to enter data in the correct format?

I have 2 other ideas, and I think they could be used together.

There isn't a "Format" event in LiveCycle, but you could get the same effect in a couple of ways

1. Use the change event to block and modifiy input data, to force it into the the correct format.

2. Use the Validate event to reformat the input data.

hbella, please start a new thread.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

hbella
Registered: Mar 10 2008
Posts: 10
hi thomp

i thought of writing a coding but i only have javascript which i'm not sure
if it can execute. maybe i'm limited in terms of my scripting.but is it possible
to use Java strictly, or is there any simple compressed code?
thanx

hbella
hbella
Registered: Mar 10 2008
Posts: 10
hi everyone

i managed to get the answer, the display data, edit data and data patterns
are pre configured into e.g ($Z, ZZ9.99) - ($ZZZ,ZZZ,ZZZ,ZZ9.99) and it's simple you don't
need any javascript coding you just add it up depending on the kind
of digits you want or decimals.

thanx guys, thomp

hbella
Sterre
Registered: Jan 29 2008
Posts: 17
thomp wrote:
Sterre,
Have you tried to set the validation pattern and the display pattern to the same values, i.e., force the users to enter data in the correct format?
The display pattern and the validation pattern are exactly the same, so that isn't the solution...

thomp wrote:
1. Use the change event to block and modifiy input data, to force it into the the correct format.2. Use the Validate event to reformat the input data.
How do I do this?
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
In the Change Event, input data is stored in the "xfa.event" object.

"event.change" holds the last keystroke
"event.newText" holds the entire imput
"even.prevText" holds the last input

Changing the value of "event.change" overides the last keystroke.

You can set "this.rawValue" in the validate function. but you have to be carefule

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

biotechnology
Registered: Feb 25 2009
Posts: 2
Hello, this is my first post but I am having a related problem...


In Live Cycle Designer 8.2 I can get my phone number to display properly, and I get the right error when someone tries to enter too many numbers....BUT if the user enters less than 10 characters it just displays what they entered....Any way to force them to enter all 10 digits?

i.e.
user input: 1234567890 --> output display: 123 456 - 7890 with no error (this is the correct format)....
user input: 12345 --> output display: 1 - 2345 with no error...
user input: 123-456-7890 --> output display: - with error message...
user input: 123456789012 --> output display: 123,456,789,012 with error message...display pattern: num{zzz zzz - zzzz}
edit pattern: num{zzzzzzzzzz}
validation pattern: num{zzzzzzzzzz}

Is there a setting I'm missing, or forgetting to change?

Thanks in advance...
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
You can control the user input with either a Script or a Picture Clause. The Picture Clause is probably easier, although I'm not sure because I haven't tried it. The Picture Clause is what's used in the display and validation patters and the is a whole document on how to write them.

http://partners.adobe.com/public/developer/en/xml/picture_clause_2.0.pdf

And here's a blog on the topic:

http://blogs.adobe.com/formfeed/picture_clause/

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/javascript.php]http://www.adobe.com/devnet/acrobat/javascript.php[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

biotechnology
Registered: Feb 25 2009
Posts: 2
Thanks for the fast response, I found the Picture Clause document link in one of your previous posts...and it really helps allot (since I am a novice, at best, when it comes to Javascript). My first mistake was using a number field, when there is a telephone pattern located under the text field....I'm playing with it more today and will post the pattern settings when I get it to work properly.