[Ctrl + Enter] - shortcut for quick form submission to Drupal

    How to make submitting a form easier in Drupal?

    The F. Ripper website uses a shortcut [Ctrl + Enter] (you can check it in the work using the link).

    You can send almost any form (whether it is a record editing form, a comment form, or the settings form in the admin panel) without resorting to the mouse, without pressing the Start button itself or its analogue - just press [Ctrl + Enter] on any page of the site, and this reduces the load on the user's hands.

    How is this done?


    Shortcut is implemented using the Drupal Keyboard Shortcut Utility module . After installing and activating the module, create a new shortcut ( / node / add / shortcut ). We set the desired key combination, in this case, specify Ctrl in the “Meta Keys” field and RETURN in the “Key> Character Code” field).

    Now in the field "Type of action or URL" select " Call a JS Function " and in the field "Action to take" enter Javascript:

    document.getElementById('edit-submit').click();

    Screenshot of the shortcut settings:

    image

    This is all that is needed - now on any page of the site, pressing Ctrl + Enter automatically calls this function.
    Undoubtedly, the solution given is primitive and there are many ways to improve it - after all, everything is possible with Drupal and imagination.

    Also popular now: