Expand my Community achievements bar.

Setting an Edit pattern does not allow inputting values

Avatar

Level 1

I'm using a custom field (Phone Number North America) in a designer form. My users want to be able to edit and display value in (999) 999-9999 format. So I set the Display and Edit formats to text{'('999')' 999-9999}. Setting this pattern only displays the value in this format, but when I go to edit the field for the first time (when the field is blank), it allows inputting without any format. And when I want to edit an inputted value in the field, it does not even allow to change anything. It seems to be readonly/locked.

What I want to be able to do is that the field must allow the user to input values in the format that I set in the Edit pattern box. This must work even if the field has a phone number value already in it.

Any help will be highly appreciated.

FYI...My Adobe LiveCycle Designer ES2 version is:  9.0.0.2.20101008.1.734229 Cipher: 128-bit.

Thanks in advance...

2 Replies

Avatar

Level 5

Hi Mahabub,

Keep the below script on exit event of the Phone Number dnt select any pattern for the field.

// Regular Expression for the phone number (999) 999-9999

var vPattern = /^(\(\d{3}\) \d{3}-\d{4})$/;

if (vPattern.test(this.rawValue))
{
app.alert("Matched");
}
else
{
app.alert("not matched")
}

This gives you Error message if the entered value is not matched with the pattern.

Please let me know if you need any more info.

Vjay

Avatar

Level 1

Thanks Vjay Reddy for your response.

This will check if the entered value conforms the format of phone number on its exit event. But my requirement is to edit the value in the phone number box with a mask like (___) ___-____

When the user continues inputting characters in the box, it should replace the underscores accordingly.

Is this possible?