Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Ghost text

Avatar

Level 3

Is there a way to enter ghost text in a field.

I would like to alert the user that only a certain number of characters are allowed in a field. By the way I am a novice when it comes to JavaScript so if someone has the answer, please be very precise as to where I should enter the script and how to enter it to get the desired results.

Thanks in advance

4 Replies

Avatar

Level 7

Hi,

I think you want there to be a default text in the field like "256 Characters Max."

If that is correct, enter something like that as the default value in the "value" tab of the "object" pallet. Change the font color to a light grey.

To clear the message, using the "enter" event, place the following formCalc script:

    if($ == "256 Characters Max.")then
        $ = ""
    endif

or if you prefer javaScript:

     if(this == "256 Characters Max."){

          this = "";

     }

Then, using the "change" event enter the following formCalc script:

    $.fontColor = "000,000,000"

or if you prefer javaScript:

     this.fontColor = "000,000,000";

This will change the font color to black when the user enters something into the field.

Cheers!

Stephen

Avatar

Level 3

Thanks Stephen,

I am still unable to get this to work. I must be doing something wrong. Anymore assistance will be appreciated

Avatar

Level 3

Thanks so much! The link was very helpful!!!!