What is the correct way of using Form Validation in Jira?

Giorgia Fineschi January 26, 2021

Hi everyone,

I am implementing a custom plugin with a configuration section in the admin page. The configuration includes a form I would like to validate using this:

https://aui.atlassian.com/aui/9.0/docs/form-validation.html

Here is what I have in my atlassian-plugin.xml

<web-resource key="eng-sla-calculator-resources" name="eng-sla-calculator Web Resources">

<dependency>com.atlassian.auiplugin:ajs</dependency>
<dependency>com.atlassian.auiplugin:aui-form-validation</dependency>

<transformation extension="js">
<transformer key="jsI18n"/>
</transformation>
<resource type="download" name="eng-sla-calculator-jira.css" location="/css/eng-sla-calculator-jira.css"/>
<resource type="download" name="eng-sla-calculator-jira.js" location="/js/eng-sla-calculator-jira.js"/>
<resource type="download" name="images/" location="/images"/>

<context>eng-sla-calculator</context>
</web-resource>

And here there is the beginning part of my .vm file:



$webResourceManager.requireResourcesForContext("eng-sla-calculator")
require('aui/form-validation')
$webResourceManager.requireResource("it.eng.esl.jira.plugins.eng-sla-calculator:eng-sla-calculator-resources")
$webResourceManager.requireResource("com.atlassian.auiplugin:aui-form-validation")


<html>

....

</html>

 

This is how I'm trying to validate my input fileds inside a form

 <input type="text" name="soglia_temporale1" class="text form-data" data-aui-validation-field data-aui-validation-required="required"/>

Nothing happens... at least I would expect the "*" to tell the user the field is mandatory.... what is the correct configuration to make the Form validation module work?

Thank you

Giorgia

 

1 answer

0 votes
Jesper Nygaard November 18, 2021

Hi @Giorgia Fineschi Did you figure this out?? I have similar issue 

Suggest an answer

Log in or Sign up to answer