TeamDesk Knowledge Base & Support

   Home      FAQ      Forum      Idea Exchange      Ask a Question      My Stuff      Help   
  
Make Ctrl+Return = SAVE
Make it so that when a user presses Ctrl+Return on any form, it is the same as pressing SAVE with the mouse. This would be a great ergonomic time saving feature. Something similar is implemented on many other systems
ID
1951
Category
User Experience
Author

Philipp Matuschka (MMB)
Date Created
1/9/2023 9:07:24 AM
Date Updated
1/12/2023 4:37:20 PM
Status
Under Consideration
Score
20
Promoted By
Patricio BustosPhilipp Matuschka (MMB)
Comments
calvin peters 1/10/2023 9:10:37 AM
If you're familiar with your dbscript.js at all you can accomplish wht you need from there...I believe..

It's not a "NO CODE" solution but it's certainly "LOW CODE"
I did try this in a dev db I'm upfitting and it seems to work as you wish it to.

Try this.

$(document).ready(function(){ // this ensures that your form is fully loaded before trying to execute any of the code.

if(jQuery("body#edit_t_{...***..}").length) { // this limits the scope of where your code will run...ie: just on this specific edit form.

$(document).bind("keydown",keyDown);

function keyDown(e){
if((e.ctrlKey) && (e.key === 'Enter')){
alert("Keys down are Ctrl + x + Return"); // not required... part of confirming the action triggered...remove or change as desired
e.preventDefault();
e.stopPropagation();
$('#frm_edit > section > header > div > button.ui-button.ui-action.v3-button.fs-action.ui-action-save').trigger('click');
}
};
};
};

at this point in the above --- if(jQuery("body#edit_t_{...***..}").length) { ---
substitute this ---{...***..}--- for your dbase table Id that you find in the URL.

If you need this to work over more than one table you can use "OR" in your if(...) condition like this

--- if(jQuery("body#edit_t_{myTbl1}").length || "body#edit_t_{myTbl2}").length || "body#edit_t_{myTbl3}").length) { ---

I played a bit with a more generic selector but couldn't make one work and figured youo might be able to get to the rest with this running start anyway.

Good luck

calvin peters 1/10/2023 9:16:45 AM
To be clear, I didn't give any thought to how something like this might work on an inline edit so it's not really a solution for that in it's current form.

calvin peters 1/10/2023 9:57:39 AM
If you use this version, it will work on a DETAILS FORM when you 'click-to-edit' a column without openning the whole form for editing.
ie:dbl click a text column and edit it then SAVE.
It should also work act more generally with any form as oppossed to specifying the form Id as previous version.

Haven't spent a lot of time debugging but it seems to do the job.

Happy coding

calvin peters 1/10/2023 9:57:48 AM

if(jQuery("#frm_edit").length) { // VINDECODER edit form for enter with "ctrl+return"
$(document).bind("keydown",keyDown);

function keyDown(f){
if((f.ctrlKey) && (f.key === 'Enter')){
alert("Keys down are Ctrl + x + Return");
f.preventDefault();
f.stopPropagation();
// $(this).closest('form').submit();
$('#frm_edit > section > header > div > button.ui-button.ui-action.v3-button.fs-action.ui-action-save').trigger('click');
$('#frm_edit > section > header > div > button:nth-child(1)').trigger('click');
}
};
};
Philipp Matuschka 1/11/2023 3:09:17 AM
Hi Calvin

Thanks for that. I might try to implement it, but in the end I really am looking for a no-code answer
Kirill Bondar  Staff  1/11/2023 4:35:36 PM
Pressing Enter when keyboard focus is on any control of the form (but multi-line input) submits the form. This is the standard browser functionality.
Philipp Matuschka 1/12/2023 4:11:49 AM
You are of course correct. I was just looking for a consistent approach that Ctrl+Return would do a SAVE regardless of which field type I am in.
Kirill Bondar  Staff  1/12/2023 4:37:20 PM
I see, Ctrl+Enter is quite popular feature these days, after Gmail I guess. It looks like it would be worthful addition to any type of form.
Feedback
 
Back to Search Results