Highlighted

text field comb - adding 0s and 1s

Community Beginner ,
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.

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Use this :

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

TOPICS
PDF forms

Views

45

Likes

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

text field comb - adding 0s and 1s

Community Beginner ,
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.

Adobe Community Professional
Correct answer by Bernd Alheit | Adobe Community Professional

Use this :

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

TOPICS
PDF forms

Views

46

Likes

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
Nov 17, 2020 0
Most Valuable Participant ,
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.

Likes

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
Reply
Loading...
Nov 17, 2020 0
Community Beginner ,
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.

Likes

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
Reply
Loading...
Nov 17, 2020 0
Adobe Community Professional ,
Nov 17, 2020

Copy link to clipboard

Copied

Use this :

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

Likes

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
Reply
Loading...
Nov 17, 2020 1
oanass LATEST
Community Beginner ,
Nov 17, 2020

Copy link to clipboard

Copied

The test field format is set to "None"

Likes

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
Reply
Loading...
Nov 17, 2020 0