Expand my Community achievements bar.

Writing in this format "9999999-99" without write the symbol "-".

Avatar

Level 1
Level 1

I have a text field that i want to writing in this format "9999999-99" without write the symbol "-" (see image 1).

What i want is to typing the first numbers and by him self skip the next character who is the symbol "-" and type the last two numbers.

The first look before write anything is like the the image 1. With the symbol "-" stable and read only.

After that i want the number to shown it as barcode below (see image 2).

Image 1

First Look.jpg

Image 2

Final Look.jpg

Thanks

KE.

3 Replies

Avatar

Level 2

You have 2 options...

  1. Create a single comb field with an edit pattern of 999999999 and a display pattern of 9999999-99.  Add a calculate event to your barcode which will populate the barcode with the display format.
          this.rawValue = lanumber.formattedValue;
  2. Create separate comb fields for the first seven digits and the last 2 digits.  Add a calculate event to your barcode field which concatenates the values together.
          this.rawValue = firstSeven.rawValue + "-" + lastTwo.rawValue;

Avatar

Level 1
Level 1
Hi Justin,

Can you be more specified? How to add a calculate event on a barcode field? Where i have to add this (this.rawValue = lanumber.formattedValue;) or this (this.rawValue = firstSeven.rawValue + "-" + lastTwo.rawValue;)?

When i add the edit pattern "999999999" i get an error which have to add another one "9" to be equal with the comb field (see image below).

Edit.jpg
Thanks
KE.

Avatar

Level 2

You can ignore the warning.  The display pattern will result in the dash being added when you tab out of the field, bringing you up to 10 characters in the field.

To add the calculate event to your barcode:

  • Click on the barcode field
  • In the script editor, select the "Calculate" event from the dropdown list
  • Add in the following code (assuming your comb field is named LANumber):

         

if (LANumber.rawValue != null)

{

   this.rawValue = LANumber.formattedValue;

}

else

{

   this.rawValue = "";

}