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

Change text field direction by javascript

New Here ,
Jun 14, 2024 Jun 14, 2024

Hello everyone , 

I was trying to use javascript for hiding and showing few fields and it works very well , but at the same time i tried to add a syntax to change the text direction but it didn't work !

 

Any one can help ? 

 

This is my code : 

if ( event.target.isBoxChecked(0)) {
    this.getField("Date").display = display.visible;
    this.getField("Text-1").display = display.visible;
    this.getField("Text-2").display = display.visible;
    this.getField("Name").display = display.visible;
    this.getField("Date-a").display = display.hidden;
    this.getField("Text-4").display = display.hidden;
    this.getField("Name-a").display = display.hidden;
} else {
    this.getField("Date").display = display.hidden;
    this.getField("Text-1").display = display.hidden;
    this.getField("Text-2").display = display.hidden;
    this.getField("Name").display = display.hidden;
    this.getField("Date-a").display = display.visible;
    this.getField("Text-4").display = display.visible;
    this.getField("Name-a").display = display.visible;
    this.getField("Text").direction = rtl;
}



 

TOPICS
Acrobat SDK and JavaScript
497
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 14, 2024 Jun 14, 2024

Text direction (RTL/LTR) can't be set using a script. You can only set the text alignment, as either "center", "right" or "left".

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 14, 2024 Jun 14, 2024

Thank you for your reply .

Do you Just through the text box options ? or by using a javascript ?! 

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 14, 2024 Jun 14, 2024

I don't follow. Do you want to change the alignment of the text in the field? Why not simply do it manually?

Does the alignment need to change?

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 14, 2024 Jun 14, 2024

I did it now by adding a second text box with different text direction in the same place and added a function to show each one on a checkbox click .. 

i think it is good now .. 

 

One more thing , is it possible to show / hide an image in the same way using a checkbox ? 

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 14, 2024 Jun 14, 2024

You can do it directly if the image is the icon of a button field, or indirectly if the image is static then you can place a (read-only) field on top of it with a white fill color and show that field when you want to hide the image, and vice versa.

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 14, 2024 Jun 14, 2024
LATEST

I will try and see .. 

Thank you so much

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