Why does the validator not show the error message on Field?

Markus Diener May 12, 2020

Hi all,

I'm very new on JIRA and script runner - hope I use all the right terminologies here.

On the customer portal I'm not getting the error message from a Simple scripted validator to the belonging filed. it appears only on top.

for testing I made a super simple test case:

  • Condition "return false;" 
  • Error Message "test"
  • Field "Summary" (Form field that the error message will appear against)

This script is placed on the "create" transition of the workflow under validators.

my create screen contains the "summary" filed.

any hints? getting lost...

 

 

1 answer

0 votes
DH September 17, 2020

Hello @Markus Diener ,

When you say "it appears only at the top", is that because you are calling the below in your validator code ?

throw new InvalidInputException("message")

but you'd rather see the error appear on the field, correct?

 

You can set an error message just below the field, but you have to do it in a 'Behaviour' instead of a 'Validator'. For example, you could do something like:

// This field
def accountType = getFieldById(getFieldChanged())
def accountVal = accountType.getValue() as String


if ('Please select'.equals(accountVal)) {
    accountType.setError("Please select a value to continue")
} else
    accountType.clearError()


 image.png

Suggest an answer

Log in or Sign up to answer