Skip to main content
Known Participant
January 16, 2019
Answered

Date and drop down field border color change

  • January 16, 2019
  • 1 reply
  • 923 views

Hi All

I have a form that has many fields. I have a line in the Custom Format Script that changes the border color once the user clicks in the field and it then changes color once the user presses enter.

// Custom Format script for text field labeling

var t1 = "Name:"

if (!event.value)

   {

    event.value = t1;

    event.target.display = display.noPrint;

    event.target.strokeColor = color.yellow;

   }

else

   {

    event.value = t1 + event.value;

    event.target.display = display.visible;

    event.target.strokeColor = color.green;

   }

This works well with the text fields, however for the drop-down it only has the green color and for the date I don't know where I could put such a script.

Kindly advise as well as if there is an option on how I can make the color setting a global script such as a document level.

Thank you

J

This topic has been closed for replies.
Correct answer try67

No, that won't work there because you can't use a custom Format script if you select the Date format.

You can use other events, though, like the Validation event, to achieve something similar.

1 reply

try67
Community Expert
Community Expert
January 16, 2019

This code works fine in a drop-down field, but you have to enable the option to allow the user to enter custom text into it.

Hansie69Author
Known Participant
January 16, 2019

Great, how about a date field ?

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 16, 2019

No, that won't work there because you can't use a custom Format script if you select the Date format.

You can use other events, though, like the Validation event, to achieve something similar.