Skip to content
Snippets Groups Projects
Commit 64ef18ee authored by hjank's avatar hjank
Browse files

# fixed bug in new scenario creation: prevent page reload on enter in name input form

# simplified event handlers for new scenario modal window input
parent 0e0015f7
No related branches found
No related tags found
No related merge requests found
...@@ -5,13 +5,9 @@ ...@@ -5,13 +5,9 @@
var global_ScenarioLiNumber = 0; var global_ScenarioLiNumber = 0;
$(function() { $(function() {
// make sure that after pressing enter in modal window "Neues Szenario erstellen" // make sure that after pressing enter in input or modal window "Neues Szenario erstellen"
// the same steps were gone like clicking on the create button // the same steps were gone like clicking on the create button
$("#modal-new-szenario").on("keyup", function(e) { return checkScenarioName(e); }); $("#modal-new-szenario, #sname").on("keyup", checkScenarioName );
// make sure that after pressing enter in input "Neues Szenario erstellen"
// the same steps were gone like clicking on the create button
$("#sname").on("keypress", function(e) { return checkScenarioName(e); });
// set the trigger for the new scenario modal window // set the trigger for the new scenario modal window
$("#showNewScenario").on("click", showNewScenario); $("#showNewScenario").on("click", showNewScenario);
...@@ -38,6 +34,10 @@ function checkScenarioName(e) { ...@@ -38,6 +34,10 @@ function checkScenarioName(e) {
function showNewScenario() { function showNewScenario() {
var newScenarioElement = $("#modal-new-szenario"); var newScenarioElement = $("#modal-new-szenario");
newScenarioElement.submit(function(e){
e.preventDefault();
});
// set focus to scenario name input field // set focus to scenario name input field
newScenarioElement.on("shown.bs.modal", function () { newScenarioElement.on("shown.bs.modal", function () {
$("#sname").focus(); $("#sname").focus();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment