I have created a ScriptRunner behavior on a multiline text field to ensure that users enter at least 50 characters for the field before updating. If there are less than 50 characters entered, an error message is displayed along with the number of remaining characters left to complete 50 characters.
The behavior script is as below and it is working and number of remaining character is updating only when I move my cursor out of the field. But I want to update the remaining characters as soon as I enter the characters (on each keypress Event).
Is it possible to display updated number of characters on each keypress Event using behaviour ?
If not, could you please tell me any other way that I can achieve this ?
final MIN_LENGTH = 50
def textField = getFieldByName("MultiLine Text Field")
def textFieldValue = textField.value as String
def textFieldLength = textFieldValue.trim().length()
if (textFieldLength < MIN_LENGTH) {
textField.setError("Length of the \"Text Field\" should not be less than 50 chars ("+(MIN_LENGTH - textFieldLength)+" characters remaining)")
}
else {
textField .clearError()
}
Join PM Evangelist, Axel Sooriah, & Product Ops. Consultant & Advisor, Jenny Wanger, as they unpack the role of product ops and discuss key takeaways in Atlassian’s ‘The Product Ops Mission’ guide. They’ll answer your questions live on May 6 at 9:00am PT.
Register here ⬇️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.