Special (number) fields in gadget preferences Edited

Hi,

 

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:

#requireResource("com.atlassian.jira.gadgets:common")
#requireResource("com.atlassian.gadgets.publisher:ajs-gadgets")
#requireResource("com.atlassian.jira.gadgets:autocomplete")

(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.

 

Regards

Christian

0 answers

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Mission-critical battery manufacturer fulfills FAA software requirements with Commit Policy Plugin

EaglePicher Technologies is a leading manufacturer of battery systems for diverse industries like defense, aviation, space or medical. As they operate in highly regulated industries, keeping a clear ...

181 views 0 2
Read article

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