Page 1 of 1
A shortcut to show an object
Posted: Thu Jan 06, 2022 9:11 am
by iezhawe
Is it possible, if I want to display the login form in a dialog using a shortcut / hotkey (example : Ctrl+F12) besides using a button / link?
Re: A shortcut to show an object
Posted: Thu Jan 06, 2022 9:55 am
by Pablo
There is no standard solution for this. This requires a custom script.
But I think it would be confusing for the user if each webpage had its own keyboard shortcuts.
Also, most shortcuts are already implemented in the browser
https://www.w3schools.com/tags/ref_keyb ... rtcuts.asp
Re: A shortcut to show an object
Posted: Thu Jan 06, 2022 10:26 am
by BaconFries
See the following url. But as Pablo mentions using this method could confuse the user. Also note that in general mobile devices don't have a alt /crtl key so implementing this could simply be pointless unless a button is also added.
https://www.theamplituhedron.com/articl ... avaScript/
Re: A shortcut to show an object
Posted: Fri Jan 07, 2022 4:23 am
by iezhawe
Thank you for your answer
Yes I understand this method will be confusing if each page uses this.
I just want to have a secret key intended for the admin on one page (and only operated on the PC) that was only to display the login dialog box or to be applied to the various other needs.
Thank you Pablo and Baconfries who always give guidance and direction.
Re: A shortcut to show an object
Posted: Sat Jan 08, 2022 11:48 am
by Joe_120
iezhawe wrote: ↑Fri Jan 07, 2022 4:23 am
I just want to have a secret key intended for the admin on one page (and only operated on the PC) that was only to display the login dialog box or to be applied to the various other needs.
Paste the following jquery into an html object and set "Before </body>" in the object dropdown.
Code: Select all
<script>
$(document).keydown(function(event) {
if (event.altKey && event.which === 65)
{
$('#indexDialog1').dialog('open');
e.preventDefault();
}
});
</script>
The keys are Alt + a and will bring up a dialog form.
You can see a demo here
https://form.discoverproductivity.co.uk/
Joe