The setup is:
Jira: 8.5.3
Scriptrunner 5.6.15.1-p5
I am trying to implement ScriptRunner custom Web Item, which launches a dialog with some fields (Implemented as REST end point, which returns corresponding markup) and on clicking some button it posts the values to another REST end point.
The construct itself seems to work. The problem comes, if I try to use validators for the input values. I try to use mechanisms described here: https://docs.atlassian.com/aui/8.6.0/docs/form-validation.html . And I want to define custom validators.
The problem is, that if I try to use `AJS.formValidation.register()`, then I see the error, that AJS.formValidation is undefined.
If I try to include `require('aui/form-validation')
` into javascript, then I get the error, that it cannot be found.
I saw, that for normal JIRA plugins to enable this one needs to adjust some XML. But how one can do it with Scriptrunner (if it is possible at all)?
Other issues:
Interestingly, the example from the same page works:
<form class="aui">
<div class="field-group">
<label for="demo-message-length">Input
with validation</label>
<input id="demo-message-length" class="text" type="text" data-aui-validation-field minlength="10">
</div>
</form>
But next example does not (none of the two validators work):
<form id="valid-submit-form" class="aui">
<div class="field-group">
<input class="text" type="text" id="input-one" data-aui-validation-field data-aui-validation-required="required">
</div>
<div class="field-group">
<input class="text" type="text" id="input-two" data-aui-validation-field data-aui-validation-max="10">
</div>
<div class="field-group">
<button class="aui-button" type="submit">Submit</button>
</div>
</form>
Notice, that for the length - different attribute is used: `data-aui-validation-max="10"` (instead of `minlength="10"` in first example).
If I replace `data-aui-validation-field data-aui-validation-required="required"` with `data-aui-validation-field required="required"`, then validation for "required" field works as expected.
Could someone explain, why is it the case?
Thank you in advance.
Hi Dmitrii,
Were you able to find a solution to this issue? I'm trying to do the same with ScriptRunner and running into the same issue.
Many thanks,
Kamran
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.