• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
2

Creating a Text Field that Place a Semi-Colon after every 10 digits.

Community Beginner ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

Below is what I have thus far:

 

var myText = this.getField(Taxonomy").value; var myText = myText.replace(/([a-zA-Z0-9]{5})/g, "$1,"); if (myText != this.getField("YourTextFieldName").value) { this.getField("YourTextFieldName").value = myText; }

 

I have placed this various areas such as action, validation, and calculation. 

TOPICS
PDF forms

Views

301

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 15, 2024 May 15, 2024

Copy link to clipboard

Copied

Do you want the semi-colon(s) to be an actual part of the field's value, or just to appear in it?

In other words, if the data of the form is exported, should they be included in the field's value?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 17, 2024 May 17, 2024

Copy link to clipboard

Copied

added to the field for exportability. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 17, 2024 May 17, 2024

Copy link to clipboard

Copied

You want to get digits from field "Taxonomy" and show digits with semicolons in field "YourTextFieldName"?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 17, 2024 May 17, 2024

Copy link to clipboard

Copied

I want to type in the taxonomy in which has 10 digits, however, if there will be more taxonomy, I want it to be separated by a semi-colon automatically.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 17, 2024 May 17, 2024

Copy link to clipboard

Copied

LATEST

Use this as validation script of that field:

var str = event.value.replace(/;/g, '');
var segments = [];

for (var i = 0; i < str.length; i += 10) {
 segments.push(str.substring(i, i + 10));}

var sc = segments.join(';');
if (str.length % 10 === 0 && str.length > 0) {
 sc += ';';}
event.value = sc;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines