Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

Place holder text

Community Beginner ,
Jun 24, 2020 Jun 24, 2020

Hello, I have made a fillable PDF form with place holder text inside the text field. The place holder text is in light grey color.

My issue is when someone types inside the text field, it comes out a light grey. I would like the typed text to be of the color black. Place holder text is light grey. I would like to see a black text color when someone starts typing in the text field box.Place holder text is light grey. I would like to see a black text color when someone starts typing in the text field box.

 

I am using the following Custom format JAVASCRIPT code - 

if (!event.value) event.value = "Describe design of the study and type (e.g., randomized clinical trial, cohort, cross-sectional, case-control, case series, survey, meta-analysis) and data analysis, including mixed-methods." {event.target.textColor = color.ltGray;}

 

Please help me out here, Thank you. 

 

TOPICS
Create PDFs , PDF forms
3.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 24, 2020 Jun 24, 2020

There's no good way to accomplish this using a single field. You can't modify a field's properties while it has focus. You'll need to set up two perfectly overlapping fields. This is actually relatively simple to do if you author the form in InDesign. The placeholder is read-only and below the editable field. The placeholder visibility is then dependent on the editable field having a value.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 24, 2020 Jun 24, 2020

Thank you for your reply, Joel.

 

Please take a look at the screenshot. As you can see #1, I have one text field box (name: significance) with Placeholder text which I have marked as Form field: visible and checked read-only.

#1#1

 

And text field box #2 ,(name: title) I have marked as Form field: hidden but printable and unchecked read-only.

 

#2#2

The issue I am having is the Title field box is always overlays the Significance text field box and therefore, the placeholder text is not visible. Is there a way or a button (bring to front) so that he placeholder text field box is brought to the front and is visible and then when someone clicks the text field they actually type in the title text field box (this is text printable) as I have kept the Significance text field box to read-only!

 

Too late to switch to adobe In-design now.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 24, 2020 Jun 24, 2020

I have accomplished what you're trying to do with a single text field. The field has it's default value set to whatever you want as the place holder text and the default text color to gray. Just make your colors as you desire. I have an "on focus" action and an "on blur" action as follows:

 

On Focus:

 

if (event.target.value==event.target.defaultValue) {
	event.target.value = "";
	event.target.textColor = color.black;
}

 

 

On Blur:

 

if (event.target.value=="") {
	event.target.value = event.target.defaultValue;
	event.target.textColor = color.gray;
}

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 24, 2020 Jun 24, 2020

Thank you rjunke,

 

I get your point.  But where should I copy and paste these Javascript codes? Look at the screenshot. Should I just copy both the codes and paste them in the 'Create and edit Javascripts' box? And then insert my placeholder text in quotation only for on BLUR code?  Can you please show the actions with a screenshot or an image. That would be very helpful to me. 

Screen Shot 2020-06-24 at 1.25.02 PM.png

 

I appreciate your reply, 

Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 24, 2020 Jun 24, 2020

I assume you are using Acrobat Pro and not some other Adobe product the creates PDFs.

 

They are action scripts. One is an On Focus action and the other is the On Blur action. They are applied as actions for the text field in question. When you're in your "Prefare Form" you can select all the fields at the same time, open the properties, and apply these actions all at once.

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 24, 2020 Jun 24, 2020

Thank you.

Your solution worked!

 

I have attached a screenshot for anyone who has the same issue as me. The screenshot shows you where to copy and paste the codes shared by our savior Rjunke. 

Goto Prepare form > select a text field > Text field propertiesGoto Prepare form > select a text field > Text field properties

 

Also to add your own text or info as a place holder text in the text field box: 

use a custom Format script:
if (!event.value) event.value = "Message text goes here."

 

Screen Shot 2020-06-24 at 2.21.17 PM.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 24, 2020 Jun 24, 2020

Great! Like the custom format script idea as well!

 

Have a great day!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 24, 2020 Jun 24, 2020

Interesting. The event processing order seems to have changed recently. I've been trying to do this using the tooltip as the placeholder for years.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 24, 2020 Jun 24, 2020

Nothing changed. I recommended this exact method several years ago, here: https://answers.acrobatusers.com/Is-add-instructional-text-text-field-disappear-clicked-q195078.aspx

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 24, 2020 Jun 24, 2020
LATEST

I think the difference is that I was never trying to change the value, just the appearance. I haven't decided if I like this method yet.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines