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

Comb of property is not functioning when Javascript added PDF is integrated in the code

Community Beginner ,
Dec 07, 2023 Dec 07, 2023

Copy link to clipboard

Copied

Hemanth34128879rd7l_0-1702005149657.png

I have eight boxes in a field similar to the one above. Each digit should go in its own box if my input value is less than or equal to 8. I am using a comb of property to accomplish that.

 

Say If my input value is greater than 8 then entire value should be adjusted in the given 8 boxes. But when I use comb of then value greater than 8 is getting trimmed off from the field.

 

Therefore, I utilized a Java script to accomplish the above scenario. Using a Java script, I was able to find the solution. It functions flawlessly in Adobe Reader. However, my code did not function when I uploaded the identical PDF in it.

 

I am using aspose library for filling out the fields. Could you please help me with the above scenario?

TOPICS
JavaScript , PDF

Views

169

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 ,
Dec 07, 2023 Dec 07, 2023

Copy link to clipboard

Copied

May be that it doesn't use the script.

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 ,
Dec 08, 2023 Dec 08, 2023

Copy link to clipboard

Copied

Not really. It's likely the library populates the value directly, without triggering the code at all. There's nothing we can do about that.

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 ,
Dec 08, 2023 Dec 08, 2023

Copy link to clipboard

Copied

The point of a comb field is to have one character per box, so trying to fit more than 8 into 8 boxes is nonsense.
The simplest and most logical solution would be to provide additional boxes.

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 ,
Dec 10, 2023 Dec 10, 2023

Copy link to clipboard

Copied

I concur that having 'N' boxes for 'N' characters makes sense. In 99.5% of circumstances, there shouldn't be more than 8 numbers in order to meet my requirements. But I can't disregard the remaining 0.5 percent of cases. I have to take care of them too. 99.5% of the others are unhappy with the alignment if I utilize the 'Comb of' property for the maximum number of characters that can be used. Characters get removed from the remaining 0.5% if I don't utilize it. So could you suggest any alternate approaches to meet both scenarios?

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 ,
Dec 10, 2023 Dec 10, 2023

Copy link to clipboard

Copied

Furthermore, I don't think adding boxes is a workable approach and that it can be done. Ever since I received these forms from an outside source.

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 ,
Dec 11, 2023 Dec 11, 2023

Copy link to clipboard

Copied

LATEST

This type of formatting with boxes dates from the days of paper forms that were filled out by hand. I also work for banks and insurance companies and I know that mentalities change slowly. Otherwise it would be too simple (see my post above).

 

Fortunately, JavaScript can compensate for their rigidity, place this script as a Custom Format Script.

Clearing its contents resets the maximum number of characters in the comb.

 

var str = event.target.valueAsString;
var strL = str.length;
event.target.comb = true; // Declare this is a comb field
event.target.charLimit = strL; // Max number of characters

 

 

Capture_2312111156.png

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