forked from jenkinsci/jenkins
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bbf2cc1
commit 1587663
Showing
2 changed files
with
30 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
core/src/main/resources/lib/hudson/newFromList/validation.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
function updateOk() { | ||
function state() { | ||
let form = document.getElementById("createItemForm"); | ||
let nameInput = document.getElementById("name"); | ||
let radios = form.querySelectorAll('input[type="radio"]'); | ||
|
||
if (nameInput.value.length === 0) { | ||
return true; | ||
} | ||
|
||
// this means we only have dummy checkboxes | ||
if (radios.length === 2) { | ||
return true; | ||
} | ||
|
||
for (i = 0; i < radios.length; i++) { | ||
if (radios[i].checked) { | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
document.getElementById("ok").disabled = state(); | ||
} | ||
|
||
updateOk(); |