I have created a form in Acrobat and would like to have placeholder text within each field instead of actual labels for each field.
The first approach was a script I inserted into "custom" under the "format" tab in properties. It would show for example, "first name" in a light gray. This worked great BUT when a user starts to enter information within that field the color of the font remained light gray.
The second option was to create insert scripts into the "onfocus" and "onblur" widgets and for some reason, I can't get onfocus (text color when someone starts filling in the field), and onblur (text that appears in the field when it's empty.) to show up at all. Below is the code to see what I'm using. Not sure if this is the correct forum but thought I'd give it a try here.
Script 1:
// Custom Format script for text field
if (!event.value) {
event.value = "Instructional text goes here";
event.target.textColor = color.ltGray;
event.target.textSize = 10;
event.target.display = display.noPrint;
}
else {
event.target.display = display.visible;
}
Script 2
// On Focus script:
if (event.target.value==event.target.defaultValue) {
event.target.value = "";
event.target.textColor = color.black;
}
// On Blur script:
if (event.target.value=="First name") {
event.target.value = event.target.defaultValue;
event.target.textColor = color.ltGray;
}