Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Phone Number

Avatar

Level 1

Hey everyone.

I should just point out that I am very very new at creating forms.

I'm sure that what I need help with won't be complicated. Here goes...

I want to create a phone number field, where whoever is filling in the form must enter the phone number in the following way:

(zz)zzzz-zzzz

This is an Australian phone number for mat where (zz) is the area code (e.g. (03). I would like livecycle to automatically insert the brackets around the area code.

the rest is self explanatory, if the user enters 00008888 (for example) or any other number combination, i want the dash to be inserted so that it becomes 0000-8888.

the end product should look like this

(03)0000-8888.

Also, I'm wondering how to make sure users know which way I want the phone number entered. Some websites I see out there work in the following way and I'm wondering whether livecyle is also capable of this:

When the user is given a blank form to fill in, the field has the following default text in it (i'll use a phone number field for example)-

(__)____-____

The user then understand that they must enter two numbers for the area code and 8 numbers for the main phone number. Forms ive seen out there also do not let the user type any more or any less characters than absolutely required. Whereas when I create a form with a phone number field, the field as blank by default and the user will be stuck wondering how the phone number should be entered...

Also, what type of field should i be using? Text, Numeric.etc

Any help would be appreciated!

2 Replies

Avatar

Former Community Member

    You can use Patterns to achieve what you want. Click on the field oand on the Object pallette on the Field Tab there is a button called patterns. Click on that a nd a separate dialog will open with 4 tabs on it. Basically the 4 tabs represent the data at different tabs and you can apply a different pattern to the data at each time if you wish. The Display pattern is when the data is on screen. The Edit pattern is when the user is entering the data. The Validation is when the data is being validated and the Data is when it is stored or written in the data file for submission. In your case you want to control what is on screen so choose the Display pattern. There is a sample on the left of that dialog for a phone number (it will be in North American format) select that. Now modify it to look like this:

text{'('99')'9999-9999}

The 9 indicates that this position is for a numeric char and the ( and ) chars are wrapped in quotes so that they are put in as a string.

Next you want to control what the user can enter. This means you have to adjust the Edit pattern. When you do this, the user can enter data in the any format but the Display pattern will only be applied to formats that you allow. You can OR the patterns together so add a pattern like this:

text{'('99')'9999-9999}|text{999999-9999}|text{9999999999}

Add any other format you feel is needed.

Lastly you can add a validation pattern. This will allow you to validate that the user has entered the right information before submitting. Note that the validation will not run until you hit the submit.

Regarding your second question, you can put a default value in the field to show the format you want (99)9999-9999. I personally do not like this way because it will pass validation but it is not a valid number. You coudl write a script that woudl blank out the field upon entry as well. You can use a tooltip on the Accessibility palette that will pop up the format when you hover on the field, or you can include the format that you want in the Caption of the field. I prefer one of the last two methods.

Hope that helps

Paul

Avatar

Level 1

Thanks!

It worked like a charm.

I'm never going back to Word for forms. Such a frustrating program!

I would like to thank you very much. I wasn't really making progress by myself, so thanks for taking the time to reply and help out

-Igor