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

How do adjust alignemnt of ghost text/ defult text to be different then enter value?

Community Beginner ,
Nov 03, 2017 Nov 03, 2017

Copy link to clipboard

Copied

My client wants the ghost text to be light grey and centred, while the enter data to the black and left aligned.

I understand how to  enter the default text and change the colour for the two but not alignment.

Here what I have

// On Focus script:

if (event.target.value==event.target.defaultValue) {

    event.target.value = "";

    event.target.textColor = color.black;

    event.target.alignment = 0

}

// On Blur script:

if (event.target.value=="") {

    event.target.value = event.target.defaultValue;

    event.target.textColor = color.ltGray;

    event.target.alignment = 1

}

TOPICS
Acrobat SDK and JavaScript , Windows

Views

416

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 ,
Nov 03, 2017 Nov 03, 2017

Copy link to clipboard

Copied

alignment is "left", "center", or "right".

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 ,
Nov 03, 2017 Nov 03, 2017

Copy link to clipboard

Copied

Bernd,

i adjusted it to left and center but it still not adjusting the alignment?

do i have event.target.alignment is right or should it be event.target.align ?

// On Focus script:

if (event.target.value==event.target.defaultValue) {

    event.target.value = "";

    event.target.textColor = color.black;

    event.target.alignment = left

}

// On Blur script:

if (event.target.value=="") {

    event.target.value = event.target.defaultValue;

    event.target.textColor = color.ltGray;

    event.target.alignment = center

}

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 ,
Nov 03, 2017 Nov 03, 2017

Copy link to clipboard

Copied

Error i got

Exception in line 5 of function top_level, script AcroForm:First:Annot1:OnFocus:Action1

ReferenceError: left is not defined

5:AcroForm:First:Annot1:OnFocus:Action1Exception in line 5 of function top_level, script AcroForm:First:Annot1:OnBlur:Action1

ReferenceError: center is not defined

5:AcroForm:First:Annot1:OnBlur:Action1Exception in line 5 of function top_level, script AcroForm:First:Annot1:OnFocus:Action1

ReferenceError: left is not defined

5:AcroForm:First:Annot1:OnFocus:Action1

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 ,
Nov 03, 2017 Nov 03, 2017

Copy link to clipboard

Copied

LATEST

Figured it out sorry - spelling mistake and noob coding error

// On Focus script:

if (event.target.value==event.target.defaultValue) {

    event.target.value = "";

    event.target.textColor = color.black;

    event.target.alignment = "left";

}

// On Blur script:

if (event.target.value=="") {

    event.target.value = event.target.defaultValue;

    event.target.textColor = color.ltGray;

    event.target.alignment = "center";

}

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