Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


How to disable cascading element child element?


I am having trouble disabling a cascading element child element in Script-Runner behaviours. When selecting this element with this script:

def childElement = getFieldById("customfield_13062:1")

The following error appears in the browser console:

Uncaught (in promise) Error: Syntax error, unrecognized expression: unsupported pseudo: 1-field
at re.error (batch.js?locale=en-US:54:8303)
at PSEUDO (batch.js?locale=en-US:54:11353)
at xe (batch.js?locale=en-US:54:15506)
at re.compile (batch.js?locale=en-US:54:16952)
at (batch.js?locale=en-US:54:17621)
at (batch.js?locale=en-US:54:2951)
at u.find (batch.js?locale=en-US:295:3640)
at u.fn.init.find (batch.js?locale=en-US:54:19592)
at u.fn.find (batch.js?locale=en-US:297:4559)
at e.getFieldForCss (batch.js?agile_global_admin_condition=true&baseurl-check-resources=true&healthcheck-resources=true&jag=true&jaguser=true&jira.create.linked.issue=true&locale=en-US&richediton=true:5093:103437)

It seems that the element "customfield_13062:1" is being interpreted as a CSS pseudo-class and breaking the validation script. How can I work around this?


Thank you.


1 answer

Suggest an answer

Log in or Sign up to answer
1 vote
Andrea Pannitti
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 02, 2022

Hi @Daniel R_,

your approach is correct but, according to HTML specs, the select tag in HTML doesn't have a readonly attribute, only a disabled attribute; so it doesn't work. A good workaround to do this, is the following:

def childElement = getFieldById("customfield_13062:1")
// To Disable
childElement.setDescription("<style onload=\"document.getElementById(\'customfield_13062:1\').setAttribute(\'disabled\',\'\')\"></style>")
// To Enable
//childElement.setDescription("<style onload=\"document.getElementById(\'customfield_13062:1\').removeAttribute(\'disabled\')\"></style>")

Hi @Andrea Pannitti

Sadly it appears that ScriptRunner's Behaviour getFieldById is not correctly sanitized and will throw an exception if trying to select a field with a colon in it's name.

Thanks for your help anyway.

Like Daniel R_ likes this
AUG Leaders

Atlassian Community Events