Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #3483 from varyvol/JENKINS-51816
[JENKINS-51816] Avoid the form to be sent when Enter is pressed.
  • Loading branch information
oleg-nenashev committed Jun 9, 2018
2 parents 1afd9f8 + fd7d1e3 commit 40d18ec
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -103,14 +103,21 @@ THE SOFTWARE.
</table>
</div>
<script>
$('root-url').focus();
var rootUrlField = $('root-url');

rootUrlField.focus();
rootUrlField.onkeydown = function(event) {
if (event.keyCode == 13){
event.preventDefault();
}
};

(function setInitialRootUrlFieldValue(){
var iframeUrl = window.location.href;
// will let the trailing slash in the rootUrl
var iframeRelativeUrl = 'setupWizard/setupWizardConfigureInstance';
var rootUrl = iframeUrl.substr(0, iframeUrl.length - iframeRelativeUrl.length);
// to keep only the root url
var rootUrlField = $('root-url');
rootUrlField.value = rootUrl
// to adjust the width of the input,
rootUrlField.size = Math.min(50, rootUrl.length);
Expand Down

0 comments on commit 40d18ec

Please sign in to comment.