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
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

25,887 views 2 7
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