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

How do I make the default title disappear?

Community Beginner ,
Feb 04, 2020 Feb 04, 2020

Hi Everyone,

 

Im making a text box that has a default value that "Name" and when the user clicks on the textbox the "Name" value automatically disappears and they can write whatever they want. If they click away without writing anything then "Name" appears back on to the textbox

 

I understand that it has to do with scripting and the script I have currently forces the user to manually delete the "Name" value out of the textbox

 

// Custom Format script for text field

if (!event.value) {

event.value = "Name";

event.target.display = display.noPrint;

} else {

event.target.display = display.visible;

 

}

 

How should I proceed?

TOPICS
Edit and convert PDFs , How to , PDF forms , Standards and accessibility
2.8K
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
1 ACCEPTED SOLUTION
Community Expert ,
Feb 04, 2020 Feb 04, 2020

// 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 == "") {
event.target.value = event.target.defaultValue;
event.target.textColor = color.ltGray;
}

 

Don't forget to enter the default value in : Text field Properties : Options : Default value


Acrobate du PDF, InDesigner et Photoshopographe

View solution in original post

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 ,
Feb 04, 2020 Feb 04, 2020

// 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 == "") {
event.target.value = event.target.defaultValue;
event.target.textColor = color.ltGray;
}

 

Don't forget to enter the default value in : Text field Properties : Options : Default value


Acrobate du PDF, InDesigner et Photoshopographe
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 ,
Feb 04, 2020 Feb 04, 2020

Thanks!

 

I am a bit confused on what/where exactly is a focus/blur script?

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 ,
Feb 04, 2020 Feb 04, 2020
LATEST

Acrobat Pro : Prepare Form : double-clic on a field : Properties : Actions : On Focus : Run a JavaScript

Acrobat Pro : Prepare Form : double-clic on a field : Properties : Actions : On Blur : Run a JavaScript


Acrobate du PDF, InDesigner et Photoshopographe
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