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

Shrinking text that doesn't fit in a form field down to a minimum size

New Here ,
Jun 07, 2017 Jun 07, 2017

Hello,

I have a PDF with a form field. The form field isn't large enough to contain every value that could be entered into it, so we want to let the users continue to enter text and have that text shrink to fit the field.

However, if the text is shrinking to below 6 pt. font, we want to prevent the user from entering any new text into the field. I'm running into issues trying to find a clean and consistent way to enforce this.

The business is determined to proceed with this approach, so I thought I'd check in and see if anyone in this community knows of an elegant approach to this problem.

Assistance is greatly appreciated!

TOPICS
PDF forms
3.1K
Translate
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
1 ACCEPTED SOLUTION
Community Expert ,
Jun 08, 2017 Jun 08, 2017
LATEST

As the custom validation script you can use something like this (for example):

if (event.value.length>100) event.target.textSize = 10;

else if (event.value.length>50) event.target.textSize = 8;

else event.target.textSize = 6;

View solution in original post

Translate
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 ,
Jun 07, 2017 Jun 07, 2017

You can limit the number of characters entered into the field. You can't

limit the size of the font, if you've selected the Auto option.

On Wed, Jun 7, 2017 at 4:57 PM, bobs91524144 <forums_noreply@adobe.com>

Translate
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
New Here ,
Jun 07, 2017 Jun 07, 2017

As I suspected, it sounds like Adobe doesn't have a combination of settings that can achieve the effect that I'm looking for.  Does anyone use a workaround or perhaps Javascript in order to achieve this?

Otherwise, am I forced to set the font to Auto so that the text shrinks, then manually identify the character limit that ensures the text doesn't shrink below 6pt?

Translate
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
New Here ,
Jun 08, 2017 Jun 08, 2017

Can anyone please confirm?  I realize the functionality is not built into Adobe, but can this be achieved via Javascript?

Thanks you!

Translate
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 ,
Jun 08, 2017 Jun 08, 2017

You can use a script to set a specific font size depending on the length of the text the user enters, but it won't change while they are typing, only when they exit the field.

Translate
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
New Here ,
Jun 08, 2017 Jun 08, 2017

That sounds encouraging.  What would the script be to achieve that effect?

Translate
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 ,
Jun 08, 2017 Jun 08, 2017
LATEST

As the custom validation script you can use something like this (for example):

if (event.value.length>100) event.target.textSize = 10;

else if (event.value.length>50) event.target.textSize = 8;

else event.target.textSize = 6;

Translate
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