Skip to main content
Participant
December 6, 2023
Answered

Create a border around a text field based on a dropdown selection

  • December 6, 2023
  • 2 replies
  • 785 views

Hi,

I have a dropdown with 5 values (1,2,3,4,5). I want the text field next to the dropdown to have a red border if 1 or 2 is selected. I've tried a ton of different scripts.

 

event.value=this.getField("Text 19").value;

if (event.value=="1")

event.target.borderColor = color.red;

 

Thank you.

This topic has been closed for replies.
Correct answer Nesa Nurani

Use this as 'Validate' script of dropdown field:

this.getField("Text 19").strokeColor = (event.value == 1 || event.value == 2) ? color.red : color.black;

2 replies

Nesa Nurani
Community Expert
Nesa NuraniCommunity ExpertCorrect answer
Community Expert
December 6, 2023

Use this as 'Validate' script of dropdown field:

this.getField("Text 19").strokeColor = (event.value == 1 || event.value == 2) ? color.red : color.black;

Participant
December 6, 2023

Thank you very much!

Bernd Alheit
Community Expert
Community Expert
December 6, 2023

Where does you use the script?