Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
May be that it doesn't use the script.
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.
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.
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?
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.
Copy link to clipboard
Copied
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
Find more inspiration, events, and resources on the new Adobe Community
Explore Now