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

adobe acrobat form texbox value direction

Community Beginner ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

I need a script to change the textbox value direction to right to left or left to right as the language in the  dropdown list i used the script below and the alignment worked useful but the direction is not working:

// Get the language from a dropdown or text field
var language = this.getField("lang").value;

// Get the text field
var textField = this.getField("Textbox");

// Set the direction based on the language
if (language === "ARABIC") {
textField.alignment = "right";
textField.direction = "rtl"; // right-to-left
} else if (language === "ENGLISH") {
textField.alignment = "left";
textField.direction = "ltr"; // left-to-right
}

 

TOPICS
Create PDFs , JavaScript , PDF , PDF forms

Views

241

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 ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

Form text fields doesn't have a property direction.

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 ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

They do, actually, but it can't be set using a script, only manually.

If your application has the RTL options enabled (under Preferences - Language) then you can set a field's direction as Right-to-Left or Left-to-Right, via its Properties, under the Appearance tab:

 

try67_1-1714987894278.png

 

 

try67_0-1714987849235.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
Community Beginner ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

I make this form for other users and I will lock any edits in the form so I need it in javascript

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 ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

I don't understand how these two things are related, but as I said, it can't be done in JS, so you need to do it manually.

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 ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

Ah, I see what you mean now, but it can't be done. As Bernd suggested, create two fields with the correct Direction option pre-selected and make them visible/hidden based on the user's selection.

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 ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

Do you mean if I have 100 Fileds I should duplicate them in the form and the code

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 ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

the script is working useful with HTML why is it not working in the PDF form

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 ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

LATEST

> Do you mean if I have 100 Fileds I should duplicate them in the form and the code

Yes.

> the script is working useful with HTML why is it not working in the PDF form

Because HTML and PDF are not the same thing.

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 ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

Screenshot 2024-05-06 124958.png

textbox option includes directions and I can change it manually but I need it in javascript 

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 ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

Use two fields with different directions and show/hide the fields in 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 Beginner ,
May 06, 2024 May 06, 2024

Copy link to clipboard

Copied

Not working

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