Hello,
I'm trying to make a post function that create an issue. In the form the user is demanded to enter the issue fields (summary, description ...) and the desired custom fields.
As showen is the pic below, I was able to show a dropdown list with custom fields and an inputtext to enter the custom field value:
And what i want to do is: once the button "Add more fields" is clicked, another dropdown list with custom fields and an inputtext to appear, so the user would be able to add a multiple custom fields.
The code is set this way:
<tr>
<td class="fieldLabelArea">
Custom Fields:
</td>
<td nowrap>
<div class="cfs">
<select name="customField1Id">
<option value=""></option>
#foreach($customField in $customFieldsList)
#if($currentCustomFieldId==$customField.getId())
<option selected value="$customField.getId()">$customField.getName()</option>
#else
<option value="$customField.getId()">$customField.getName()</option>
#end
#end
</select>
<input name="customField1value" id="customField1value" value="$customField1value" />
</div>
<button id='add'>Add more fields</button>
</td>
</tr>
And I added JS code for the button, to show new form:
(function() {
var button=document.getElementById("add");
button.addEventListener('click', function(event) {
event.stopPropagation();
event.preventDefault();
var cln = document.getElementsByClassName("cf")[0].cloneNode(true);
document.getElementById("users").insertBefore(cln,this);
return false;
});
})();
However, nothing happent once the button is clicked... I tested the code on simple html page and js file, it works fine ... but never on my post-function plugin...
I tried to put the JS code on the .vm file inside <script></script>, and I tried to put it in javascript file and calling it as web resource in .vm file:
$webResourceManager.requireResource("com.codix.postfunction:Jira7CreateNewTaskDependingOnFields-resources")
However, but both ways failed ... so I'm confused what's the proper way to call the JS code!!
Could you please help :D !!
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.