Last active
May 12, 2020 02:22
-
-
Save SamBahrami/c1bfbbd85b5fb87befca553c3d18d7cb to your computer and use it in GitHub Desktop.
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
var num_obj = 1; | |
document.querySelector('crowd-form').onsubmit = function(e) { | |
const keypoints = document.querySelector('crowd-bounding-box').value.boundingBoxes || document.querySelector('crowd-bounding-box')._submittableValue.keypoints; | |
const labels = keypoints.map(function(p) { | |
return p.label; | |
}); | |
if (labels.length != num_obj) { | |
e.preventDefault(); | |
errorBox.innerHTML = '<crowd-alert type="error" dismissible>You must add exactly one bounding box on an object in the scene. If you have more than one drawn, please delete the additional ones and try to submit again.</crowd-alert>'; | |
errorBox.scrollIntoView(); | |
return; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment