Special (number) fields in gadget preferences Edited



I am currently developing a gadget plugin in Jira 7.2. After the troublesome work I have finally managed to get the preference page for my gadget to work properly.

For example I want the user to be able to chose a standard height for the gadget. Lets say it all works fine until someone decides to write non numerics into this field. That's the reason why it needs to be a number field only.

<UserPref name="custom_height" default_value="300" />

The basic idea applies to other fields too, i.e. date fields or other numeric fields in the user preferences. So a general approach would be appreciated.


The only thing I found about this topic was https://developer.atlassian.com/display/GADGETS/Field+Definitions

The 'class' definition should therefore create the number field restriction. First of all, I think they have a comma missing at the end there, as all other field definitions are separated with one.

class: "numField"

After trying with and without comma, both resulted in my gadget crashing. The browser console didn't have any error message and the server log exceptions don't really help, as an error inside the gadget always causes the rest resource to crash, thus resulting in a rest resource crashing exception.

My used resources:


(So far I couldn't find reasons or differences of using ajs-gadgets or gadgets:common. It just proved to be good to have both included, so if anyone has a good documentation link, I'll be happy to get it)

Some more search revealed this issue: https://jira.atlassian.com/browse/JRASERVER-21517 which exactly describes the problem with the use of classes in gadgets. Sadly it has been sitting there for 7 years without a resolution.

edit: now the link is dead. It said that classes are not working in gadget.


I assume I can't be the only one who needs this functionality in a gadget. Is there any workaround? Did I make some basic mistake or miss some resources? Thank you in advance for any helpful hints or solutions.




0 answers

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

158 views 2 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you