Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Dynamic form font color changes after saving

Avatar

Level 3

I have a dynamic form that before the user clicks inside a textfield ghost text appearance is set to red once the user starts typing I have an event set to turn the font to black.


The problem is, once form is saved and reopened the font color is red instead of black. How can I get the font color to remain black?

I am thinking that script should be in the PreSave event if so, please provide an example of how it should be written.

Thanks


1 Accepted Solution

Avatar

Correct answer by
Level 10

Ok,

I see you use the ghost text sample from BR001.

Change the exit script to:

View solution in original post

6 Replies

Avatar

Level 10

The script in the preSave:Event of the textf field looks:

But, if the color still changes to red after reopening the form your other script replaces the results of the script above.

In this case you need to change the other script.

Avatar

Level 3

I was afraid that would be the answer that you would give me for the PreSave event, I was hoping that I had my script wrong.

Now as for changing the other script - the text is red to alert customers of how many characters the field will allow, so I didn't want to change the color of the ghost text.

There must be some way for this text to remain black once the form is saved and reopened. Unless I am not understanding what you are meaning as far as changing the "other" script.

Thanks for your help

Avatar

Level 10

By the "other script" I mean the script you already use to change your text color to red.

This script seems to change the text color to red in many circumstances, which causes the red text color after reopening the form.

How does it looks like, the "other script"?

Avatar

Level 3

I have several events happening in the text field

for the ghost text (tool tip) I have set an initialize event: (by the way I did choose the color red for the font in the color picker for the tooltip color)

this.execEvent("exit");

this.format.picture.value = "null{' " + this.assist.toolTip.value + " '}";   

Enter event: (this changes the font to black and bullets appear)

this.fontColor + "0,0,0";

this.font.posture = "normal";

if(this.rawValue === null)

    {

    this.rawValue = "l ";

    }

Exit event

if (this.isNull)

{

   this.fontColor = "255,0,0,";

   this.fontposture = "italic";

Avatar

Correct answer by
Level 10

Ok,

I see you use the ghost text sample from BR001.

Change the exit script to:

Avatar

Level 3

Thank you so much!!!!

It works!!!!!