Merge pull request #17965 from OPEN-DSI/new-expensereport-prevent-submit-on-enter-key

NEW prevent default submit form on enter key in expense card
This commit is contained in:
Laurent Destailleur 2021-06-17 17:51:56 +02:00 committed by GitHub
commit bbc6e9d8ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2191,17 +2191,34 @@ if ($action == 'create') {
$( ".auploadnewfilenow" ).click(function() { $( ".auploadnewfilenow" ).click(function() {
jQuery(".truploadnewfilenow").toggle(); jQuery(".truploadnewfilenow").toggle();
jQuery(".trattachnewfilenow").hide(); jQuery(".trattachnewfilenow").hide();
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
return false; return false;
}); });
$( ".aattachtodoc" ).click(function() { $( ".aattachtodoc" ).click(function() {
jQuery(".trattachnewfilenow").toggle(); jQuery(".trattachnewfilenow").toggle();
jQuery(".truploadnewfilenow").hide(); jQuery(".truploadnewfilenow").hide();
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
return false; return false;
});'; });';
if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array'))) { if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array'))) {
print 'jQuery(".trattachnewfilenow").toggle();'."\n"; print 'jQuery(".trattachnewfilenow").toggle();'."\n";
} }
print ' print '
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
';
print '
}); });
'; ';
print '</script>'."\n"; print '</script>'."\n";
@ -2337,17 +2354,34 @@ if ($action == 'create') {
$( ".auploadnewfilenow" ).click(function() { $( ".auploadnewfilenow" ).click(function() {
jQuery(".truploadnewfilenow").toggle(); jQuery(".truploadnewfilenow").toggle();
jQuery(".trattachnewfilenow").hide(); jQuery(".trattachnewfilenow").hide();
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
return false; return false;
}); });
$( ".aattachtodoc" ).click(function() { $( ".aattachtodoc" ).click(function() {
jQuery(".trattachnewfilenow").toggle(); jQuery(".trattachnewfilenow").toggle();
jQuery(".truploadnewfilenow").hide(); jQuery(".truploadnewfilenow").hide();
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
return false; return false;
});'."\n"; });'."\n";
if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array')) && $action != 'updateline') { if (is_array(GETPOST('attachfile', 'array')) && count(GETPOST('attachfile', 'array')) && $action != 'updateline') {
print 'jQuery(".trattachnewfilenow").show();'."\n"; print 'jQuery(".trattachnewfilenow").show();'."\n";
} }
print ' print '
if (jQuery(".truploadnewfilenow").is(":hidden")) {
jQuery("input[name=\"sendit\"]").prop("disabled", true);
} else {
jQuery("input[name=\"sendit\"]").prop("disabled", false);
}
';
print '
}); });
'; ';
print '</script>'."\n"; print '</script>'."\n";