Skip to content

Commit

Permalink
Use unique ID for forms
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynek committed Oct 27, 2024
1 parent 6faa35a commit e2b61e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler"
xmlns:l="/lib/layout" xmlns:dd="/lib/layout/dropdowns" xmlns:f="/lib/form">
<j:if test="${it.hasPermission(it.PROVISION)}">
<j:set var="formId" value="${h.generateId()}"/>
<tr>
<td />
<td colspan="${monitors.size()+2}">
Expand All @@ -36,13 +37,14 @@ THE SOFTWARE.
<dd:custom>
<button class="jenkins-dropdown__item"
data-type="ec2-provision"
data-form="${formId}"
data-url="${t.description}">
${t.displayName}
</button>
</dd:custom>
</j:forEach>
</l:overflowButton>
<f:form action="${rootURL}/${it.url}/provision" method="post" name="provision">
<f:form action="${rootURL}/${it.url}/provision" method="post" name="provision" id="${formId}">
<input name="template" type="hidden"/>
</f:form>
<st:adjunct includes="hudson.plugins.ec2.EC2Cloud.provision"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Behaviour.specify("[data-type='ec2-provision']", 'ec2-provision', -99, function(e) {
e.addEventListener("click", function (event) {
const form = document.querySelector("form[name='provision']");
const form = document.getElementById(e.dataset.form);
form.querySelector("[name='template']").value = e.dataset.url;
buildFormTree(form);
form.submit();
Expand Down

0 comments on commit e2b61e2

Please sign in to comment.