Skip to main content
Participant
October 28, 2016
Question

How do i edit this javascript - to show black text when first initial typing of text field?

  • October 28, 2016
  • 3 replies
  • 438 views

Hi All,

Need some help here!

I have got a javascript from a forum previously. The purpose of the script is to have a watermark text (grey colour) in the text field box that will hide upon typing. When typing or after data in keyed in, the text should appear full black. The problem with my current script is that when first initial typing of the text, the text is grey colour and only turn full black when exit. How do i keep the watermark in grey, when typing shows black colour text, and black colour text data after input?

The script is such:

var message = 'DD'

if (event.value == '') {

    event.target.display = display.noPrint

    event.value = message

event.target.textColor = ["G",0.8] ;

} else {

    event.target.display = display.visible

if (event.target.value==event.target.defaultValue) event.target.value = "";

event.target.textColor = ["G",0] ;

}

Thanks!

This topic has been closed for replies.

3 replies

try67
Community Expert
Community Expert
October 28, 2016

Where did you place these codes, exactly? (under what field actions)

Participant
October 28, 2016

Hi there,

In Adobe Acrobat, i have a text field, and under Properties-Format-Custom, i placed the code in the Custom Format Script, not in any field actions.

Could you kindly advise?

Thanks!

try67
Community Expert
Community Expert
October 28, 2016