Forum

Welcome to ProjeQtOr new Forum. We migrated old forum to the new website.
You will find all your posts here, with your usual account.
Just one point : you’ll have to reinitialize your password. Use “Lost password” feature.

[SOLVED] [CTRL]-S t...
 
Notifications
Clear all

[SOLVED] [CTRL]-S to save in form window broken ?

7 Posts
4 Users
0 Reactions
10.8 K Views
 DPo
(@dpo)
Posts: 11
Active Member
Topic starter
 
[#2033]

Hi,
It seems that the behavior of [CTRL]-S is broken in the form frame (general for all the objects : project, activity, ...).
I used to save directly with a [ctrl]-S directly when in any input object of the form. Now a window of firefox open to save the html page :huh: .

Although, it seems, that when clicking / focusing into the menu of the frame (where the buttons stand), [ctrl]-S has the right behavior and save the form.

Version Projeqtor : 4.4.2
Firefox : 32.0.3


 
Posted : 07 Oct 2014 19H21
(@babynus)
Posts: 14952
Member Admin
 

Hi,

This seems to be a V4.4 regression on FireFox.
I checked : works fine on Chrome & IE, works fine on Firefox with V4.3.

Ticket #1544 recorded


 
Posted : 07 Oct 2014 19H48
 Dan
(@caccia)
Posts: 340
Contributor
 

Hi all,

Noticed the same - only on Firefox it seems. One of our developers had a look and found a solution, so hopefully this can help others:

1) in main.php, around line 170:
replace:

      var onKeyPressFunc = function(event) {
        if(event.ctrlKey && event.keyChar == 's'){
          event.preventDefault();
        	globalSave();
        } else if (event.keyCode==dojo.keys.F1 && ! event.keyChar) {
        	event.preventDefault();
        	showHelp();
        }  
      };

with :

     var onKeyPressFunc = document.addEventListener("keydown", function(e) {
        if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)) { // CTRL + S
          e.preventDefault();
          stopDef();
          globalSave();
        } else if (e.keyCode == 112) { // On F1
          e.preventDefault();
          stopDef();
          showHelp();
        }
      }, false);

2) In projeqtor.js, add function:

// Prevent default && "unfocus" all inputs

function stopDef(e) {
  var inputs, index;

  inputs = document.getElementsByTagName('input');
  for (index = 0; index < inputs.length; ++index) {
      inputs[index].blur(); 
  }

  if (e && e.preventDefault)
    e.preventDefault();
  else if (window.event && window.event.returnValue)
    window.eventReturnValue = false;
};

 
Posted : 07 Oct 2014 19H56
(@babynus)
Posts: 14952
Member Admin
 

Hi,

Thanks caccia for the workaround.
It confirms my analysis : on FF, the onkeypress is not triggered when focus is in an input field.
So the idea to add listener on the keydown that blurs the field when needed fixes the issue.
But this can lead to loose of focus. Not important if save is correct (frame is refreshed) but if error occurs, focus is lost.

By the way, it was working on V4.3, so I tried to replace dojo version from V10.0 (used un V4.4) to V9.3 (used on V4.4) : and this fixes the issue.
So simple fix is to retrieve /external/dojo /external/dijit and /external/dojox from V4.3.x and overwrite it on V4.4.

NB : I tested Dojo V10.1, issue still exists.


 
Posted : 07 Oct 2014 20H34
(@babynus)
Posts: 14952
Member Admin
 

For information I openned an issue in Dojo Trac database : #18303
https://bugs.dojotoolkit.org/ticket/18303


 
Posted : 07 Oct 2014 22H23
(@jarekd)
Posts: 3
New Member
 

There seems to be another bug. Occurs in 4.4.2 using Chrome. Not sure but might be related to Dojo as well.

Pressing Right Alt + 's' invokes ProjeQtOr save function despite the condition in main.php checking for CTRL key.

I use the Alt+'s' to enter national character so it is confusing. Temporarily removed Ctrl+S shortcut code from main.php.

ProjeQtOr 4.4.2 Chrome 38.0.2125.101 m


 
Posted : 14 Oct 2014 19H51
(@babynus)
Posts: 14952
Member Admin
 

Hi,

Strange, but AltGr sets event.ctrlKey ti true.
And it is nit browser dependant...

Solution : in /view/main.php, replace

var onKeyPressFunc = function(event) {
        if(event.ctrlKey && event.keyChar == 's'){

with

var onKeyPressFunc = function(event) {
        if(event.ctrlKey && ! event.altKey && event.keyChar == 's'){

Fix will be included in V4.5.0


 
Posted : 15 Oct 2014 18H33
Share:

Scroll to Top