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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,316 views 14 20
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot