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

javascript paragraph formatting in form text field

Explorer ,
Feb 07, 2020 Feb 07, 2020

Copy link to clipboard

Copied

Hi - I am new with javascript and seem to be hitting a bunch of dead ends. I am trying to create a form with multiple check boxes, Based on the selection of text boxes a full letter will populate. Right now I am using scrip that looks like this 

 

var a = this.getField("options").value;
if(a == "a"){
event.value = "Option A paragraph";
}
else if(a == "b"){
event.value = "Options B paragraph";
}

I have done this script for all 10 chck boxes and have 10 coressponding text box fields to popoulate the informaton in. 

 

But I am now realizing that the paragraph options are all different lengths and the letter would have to be formatted each time. 

Is there a script that would auto format all the paragraph spacing? or should I use one big long text box (but it would have to be multiple pages) with a long script. 

 

Last question: can you format paragraphs with javascript ?

 

Thank you 

 

 

TOPICS
Acrobat SDK and JavaScript

Views

1.1K

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 , Feb 07, 2020 Feb 07, 2020

The answer is yes and no.  

Fields can display "Rich Text", which gives you the ability to apply some formatting options.  You can test this out by setting one of your text fields to Rich Text and multi-line from the Options tab on the field properties dialog. Then use the properties toolbar to set paragraph formatting options. There are more options on the Properties toolbar than there are in JavaScript. Many of these are undocumented, so you have to experiment to see what you can get.

Display

...

Votes

Translate

Translate
Community Expert ,
Feb 07, 2020 Feb 07, 2020

Copy link to clipboard

Copied

LATEST

The answer is yes and no.  

Fields can display "Rich Text", which gives you the ability to apply some formatting options.  You can test this out by setting one of your text fields to Rich Text and multi-line from the Options tab on the field properties dialog. Then use the properties toolbar to set paragraph formatting options. There are more options on the Properties toolbar than there are in JavaScript. Many of these are undocumented, so you have to experiment to see what you can get.

Display the Properties bar with Ctrl-E. Be sure to check out the "More..." button. 

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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