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

Add form validation in Jira plugin template

Frédéric Esnault July 1, 2015

Hi everyone,

I'm facing a little difficulty here.

I created a page template for my plugin, in which I added a form. What I would like is to add validation to fields of this form (for example, check that entered value is an email using a regexp).

I looked at the AUI documentation, and saw that I had to add an AMD module called aui/form-validation.

But  adding in the javascript part of my template the following code does not work :

require(['aui/form-validation']);

In the Javascript console, I see the following message (and of course validation does not work) :

Uncaught Error: undefined missing aui/form-validation

Debugging the javascript raising the error did not help.

In my plugin, I defined the jira.api version to 6.3.15.

It leads to the aui version defined like this : 

<auiplugin.parent.version>5.6.7-jira-1</auiplugin.parent.version>

And the form-validation exists since AUI version 5.5.

Does anyone knows what is going on and how to fix it please ?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Eric Hofstetter July 11, 2015

Frédéric,

I was having similar issues with including form validation in my own plugin.  One thing that helped me was to include the require statement after the AJS.toInit call in my .js

AJS.toInit(function(){
 require(['aui/form-validation']);
 ...
});

If you haven't already, you'll want to include the dependencies listed at https://docs.atlassian.com/aui/latest/ under "Serve from CDN".

Atlassian also has a Sandbox available at https://docs.atlassian.com/aui/5.7.0/sandbox/ which I found very useful for testing/adjusting my code.

Hope this helps!

 
TAGS
AUG Leaders

Atlassian Community Events