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

text field comb - adding 0s and 1s

Explorer ,
Nov 17, 2020 Nov 17, 2020

Copy link to clipboard

Copied

Hello,

 

I have a text field and I set it to "Comb of 10 characters". The field will consist of 0s and 1s.

01010111..

 

I'm trying to add 0s and 1s to the field during some operations but it's not working as expected. I would like it to be considered as a string.

 

this.getField("Text1").value = this.getField("Text1").value +"0";

Any idea? Thank you.

TOPICS
PDF forms

Views

421

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

correct answers 1 Correct answer

Community Expert , Nov 17, 2020 Nov 17, 2020

Use this :

this.getField("Text1").value = this.getField("Text1").valueAsString +"0";

Votes

Translate

Translate
Community Expert ,
Nov 17, 2020 Nov 17, 2020

Copy link to clipboard

Copied

You can't add additional characters beyond the limit of the Comb setting, if that's what you mean.

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
Explorer ,
Nov 17, 2020 Nov 17, 2020

Copy link to clipboard

Copied

No, it's not what I mean. Yes, I know the max number is 10.

 

The problem is that after something like this

this.resetForm(["Text1"]);

this.getField("Text1").value = this.getField("Text1").value +"0";

this.getField("Text1").value = this.getField("Text1").value +"1";

this.getField("Text1").value = this.getField("Text1").value +"0";

 

The result is 10 not 010.

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 ,
Nov 17, 2020 Nov 17, 2020

Copy link to clipboard

Copied

Use this :

this.getField("Text1").value = this.getField("Text1").valueAsString +"0";

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
Explorer ,
Nov 17, 2020 Nov 17, 2020

Copy link to clipboard

Copied

LATEST

The test field format is set to "None"

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