fix: [UI] Submit form on CTRL+ENTER on select

pull/8668/head
Jakub Onderka 2022-10-14 12:58:08 +02:00
parent 3fc1441259
commit aacd19a318
6 changed files with 8 additions and 36 deletions

View File

@ -35,7 +35,7 @@ class AppController extends Controller
public $helpers = array('OrgImg', 'FontAwesome', 'UserName');
private $__queryVersion = '145';
private $__queryVersion = '146';
public $pyMispVersion = '2.4.162';
public $phpmin = '7.2';
public $phprec = '7.4';

View File

@ -12,16 +12,9 @@
<?= $this->Form->postLink(
h($actionName),
$this->request->here(),
['class' => 'btn btn-primary button-execute']
['class' => 'btn btn-primary']
)
?>
<button type="button" class="btn btn-secondary cancel-button" data-dismiss="modal"><?= __('Cancel') ?></button>
</div>
</div>
<script type="text/javascript">
$(document).keydown(function(e) {
if(e.which === 13 && e.ctrlKey) {
$('.button-execute').click();
}
});
</script>

View File

@ -12,16 +12,9 @@
<?= $this->Form->postLink(
h($actionName),
$this->request->here(),
['class' => 'btn btn-primary button-execute']
['class' => 'btn btn-primary']
)
?>
<button type="button" class="btn btn-secondary cancel-button" data-dismiss="modal"><?= __('Cancel') ?></button>
</div>
</div>
<script type="text/javascript">
$(document).keydown(function(e) {
if(e.which === 13 && e.ctrlKey) {
$('.button-execute').click();
}
});
</script>

View File

@ -23,17 +23,10 @@ $title = Inflector::singularize(Inflector::humanize(Inflector::underscore($this-
<?= $this->Form->postLink(
'Delete',
$this->request->here(),
['class' => 'btn btn-primary button-execute']
['class' => 'btn btn-primary']
)
?>
<button type="button" class="btn btn-secondary cancel-button" data-dismiss="modal"><?= __('Cancel') ?></button>
</div>
<?php endif; ?>
</div>
<script type="text/javascript">
$(document).keydown(function(e) {
if (e.which === 13 && e.ctrlKey) {
$('.button-execute').click();
}
});
</script>
</div>

View File

@ -18,14 +18,7 @@
?>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary button-execute" onclick="$('#<?= $randomNumber . 'Form' ?>').submit();"><?= __('Submit') ?></button>
<button type="button" class="btn btn-primary" onclick="$('#<?= $randomNumber . 'Form' ?>').submit();"><?= __('Submit') ?></button>
<button type="button" class="btn btn-secondary cancel-button" data-dismiss="modal"><?= __('Cancel') ?></button>
</div>
</div>
<script type="text/javascript">
$(document).keydown(function(e) {
if(e.which === 13 && e.ctrlKey) {
$('.button-execute').click();
}
});
</script>

View File

@ -4849,8 +4849,8 @@ $(document.body).on('keyup', '#quickFilterField', function(e) {
}
});
// Send textarea form on CMD+ENTER or CTRL+ENTER
$(document.body).on('keydown', 'textarea', function(e) {
// Send textarea or select form on CMD+ENTER or CTRL+ENTER
$(document.body).on('keydown', 'textarea, select', function(e) {
if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) { // CMD+ENTER or CTRL+ENTER key
if (e.target.form) {
$(e.target.form).submit();