Copy link to clipboard
Copied
Okay, so... I'm trying to figure out how to have default text show in a form field/text field until the user clicks on it and inputs their own data. I don't want labels, I just want default values to be displayed in the fields.
I've read through so many forums, and they all have code along these lines:
event.target.value = event.target.defaultValue;
event.target.textColor = color.ltGray;
}
I've tried every suggestion I found, but it still doesn't work.
Using Acrobat XI Pro.
Finally got it. I was trying to use the scripts I've seen for the entire form. I didn't know you had to set actions for the form fields.
I'm going to break it down Barney style for the new users (like myself).
- Add a text field to your form
- View the text field's properties
- Under the Options tab, enter the default text that you want to be displayed
- Under the actions tab, select trigger On Focus, select action Run a JavaScript, click Add...
- Paste the following:
// On Focus script:
if (event.targe
Copy link to clipboard
Copied
Finally got it. I was trying to use the scripts I've seen for the entire form. I didn't know you had to set actions for the form fields.
I'm going to break it down for the new users (like myself).
- Add a text field to your form
- View the text field's properties
- Under the Options tab, enter the default text that you want to be displayed
- Under the actions tab, select trigger On Focus, select action Run a JavaScript, click Add...
- Paste the following:
if(event.target.value==event.target.defaultValue)event.target.value="";
- Same steps but now under On Blur instead of On Focus, select action Run a JavaScript, click Add...
- Paste the following:
if(event.target.value=="")event.target.value=event.target.defaultValue;
Copy link to clipboard
Copied
Why does you post copies of replies?