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

Community Beginner ,
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, Macintosh, Windows

Views

133

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Nov 03, 2017

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
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

}

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
jenniferc11972072 AUTHOR LATEST
Community Beginner ,
Nov 03, 2017

Copy link to clipboard

Copied

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";

}

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more