Skip to content

Commit

Permalink
use document.getElementsByName() to trigger the default command #999
Browse files Browse the repository at this point in the history
  • Loading branch information
geopossachs authored and stephanrauh committed Aug 1, 2019
1 parent ea5feb7 commit 791a592
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ public void encodeEnd(FacesContext context) throws IOException {
rw.writeText("" + "$(function() { " + " $('form#"
+ BsfUtils.escapeJQuerySpecialCharsInSelector(formId) + " input').keypress(function (e) { "
+ " if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { "
+ " document.getElementById('" + actionCommandId + "').click();return false; "
+ " document.getElementsByName('" + actionCommandId + "')[0].click();return false; "
+ " } else { " + " console.log('keycode not 13'); " + " return true; "
+ " } " + " }); " + "});", null);

rw.writeText("" + "$(function() { " + " $('form#"
+ BsfUtils.escapeJQuerySpecialCharsInSelector(formId) + " textarea').keypress(function (e) { "
+ " if ((e.ctrlKey && e.which && e.which == 13) || (e.ctrlKey && e.keyCode && e.keyCode == 13)) { "
+ " document.getElementById('" + actionCommandId + "').click();return false; "
+ " document.getElementsByName('" + actionCommandId + "')[0].click();return false; "
+ " } else { " + " console.log('keycode not 13 or ctrl not pressed'); " + " return true; "
+ " } " + " }); " + "});", null);

Expand Down

0 comments on commit 791a592

Please sign in to comment.