Copy link to clipboard
Copied
I want to have ghost text (instructions) and default text (necessary language) on the same form field. Is this possible?
Change that format script to:
// Custom Format script for text field
if (event.value === event.target.defaultValue) {
event.value = "Text goes here";
event.target.display = display.noPrint;
} else {
event.target.display = display.visible;
}
Set the default value of the field to "Please provide ", and you might want to add the following custom Validate script:
if (!event.value) {
event.value = event.target.defaultValue;
}
Copy link to clipboard
Copied
Hi juliaf71725967,
Would request you to please elaborate you workflow,what changes you are looking for in the field information so that we can help you more effectively.
Regards,
Yatharth
Copy link to clipboard
Copied
I have a JavaScript written to allow "Ghost Text" or placeholder text that disappears in the field when the user completes it. The placeholder text is instructions, for example "Write Out Number."
However, I want to also allow Default text to appear when the user attempts to fill out the form (upon selection of the field, the ghost text disappears but the default text appears). The default text is required information, such as "Please provide" xxxx. The user is required to fill out the xxx with the written number, but the "Please provide" is required by the person accepting the form.
Tooltips are not viable, as the users are not familiar with hovering.
Copy link to clipboard
Copied
You will also have to consider the formatting of the field because fields with a format like number, date or time cannot accept alphabetical characters so gray instructions could not appear in the field. If one makes all fields with a format of "None" then you need to use custom scripting to perform all validation for entered data like dates and numbers. And a lot of this work will need to be redone when summing a number of fields.
You might want to first see how a simple form works and then work on adding the more advanced features.
Copy link to clipboard
Copied
Not relevant. All fields are formatted "None" because the filler is not required to be a number/date/etc. It is all text.
This is an upgrade to a simple form. The users require more instruction to fill it out correctly, however, those instructions cannot be visible. Unfortunately, the Tooltip function was not to their liking.
The placeholder text is a hit, however, they still want the default text to prompt them how to fill out the field correctly after receiving instruction. I just wondered if this was possible?
When I try to enter the default text, it overrides my script for the placeholder text.
Copy link to clipboard
Copied
What script are you using? It can probably be altered to allow what you want.
Copy link to clipboard
Copied
// Custom Format script for text field
if (!event.value) {
event.value = "Text goes here";
event.target.display = display.noPrint;
} else {
event.target.display = display.visible;
}
Copy link to clipboard
Copied
Change that format script to:
// Custom Format script for text field
if (event.value === event.target.defaultValue) {
event.value = "Text goes here";
event.target.display = display.noPrint;
} else {
event.target.display = display.visible;
}
Set the default value of the field to "Please provide ", and you might want to add the following custom Validate script:
if (!event.value) {
event.value = event.target.defaultValue;
}
Copy link to clipboard
Copied
Thank you so much! That worked!
Copy link to clipboard
Copied
Is there a way to change the formatting on this ghost text javascript? For instance, I would like to make it very light gray and italic so that it's clear the field hasn't been filled in.
Copy link to clipboard
Copied
You can the field's text color using the fields fontColor and setting to the appropriate color array value. You can change the font using the textFont property with the correct name for the font and affect.
Copy link to clipboard
Copied
Would you be able to tell me how to change the font size?
I have this script working for OnFocus, and just want to change the font to 9 pt when the user fills in the field.
// On Focus script:
if (event.target.value==event.target.defaultValue) {
event.target.value = "";
event.target.textColor = color.black;
}
Copy link to clipboard
Copied
Add this line to the code:
event.target.textSize = 9;
Copy link to clipboard
Copied
Thank you! That worked.
Copy link to clipboard
Copied
You can use the property Tooltip for the instructions.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now