Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to stop Refreshing a page when pressing F5 key

    Dear All,

    I'm having a dynamic form having a comboBox item.

    Using optionDatasource for comboBox item.

    And i'm refreshing the data in the comboBox while pressing F5 key in the
    comboBoxItem.

    Refresh is working fine but page refresh is also happening.

    My code to refresh data is
    Code:
    keyDown : "if(keyName == 'f5'){this.getOptionDataSource().testData = parent.getDDDWRec(this.optionDataSource, {}, document, {}, true);this.fetchData();return false;}"

    I cannot stop only f5 key, while i tried with other keys its stopping. I have to stop propagation and bubbling of the event.

    Please help me...
    Thanks in advance

    -Harikrishnadhas.K

    #2
    I am also trying to stop global keyboard shortcuts from being captured by IE's standard keyboard mappings, e.g.:

    Code:
       ...
       isc.Page.registerKey({keyName: "D", ctrlKey: true},
           "dialNumberIcon.click();return isc.EH.killEvent();");
       ...
    In our former dojo-based application we were able to capture CTRL-D on IE for being used by our application. With SmartClient, IE just shows his bookmark dialog. I also tried to overwrite isc.EH.killEvent (which I am calling from my action handler, see above) with following workaround, with no success:

    Code:
       ...
       isc.EH.killEvent = function() {
            var event = isc.EH.getWindow().event;
            event.cancelBubble = true;
            if (isc.Browser.isIE) {
                try {
                    event.keyCode = 0;
                }
                catch (e) {}
            }
            event.returnValue = false;
            return false;
        };
       ...
    This is more or less, what dojo does on IE browsers. For whatever reasons, it has no effect with SmartClient's event architecture.

    Any pointer how to proceed?

    Comment


      #3
      Is it possible that the browser has changed and no longer allows the event to be canceled? If this event is able to be canceled, this is the type of thing that browser vendors might one day decide is a bug, and correct. Subverting shortcut keys is a very iffy practice.

      Comment


        #4
        In this case, the browser did not change. I can test it with our old dojo-based application: CTRL-D (among other shortcuts) is successfully captured there with IE 7 and IE 8.
        So it must really depend on some little piece that is being implemented differently (timing? - whatever).

        To come back to the original thread: F5 is not even captured by dojo. This one always reloads the screen...

        The point about subverting shortcuts is: When you really take the promise serious to develop real applications, not just web pages, you might want to give standard shortcuts to the user. If you look at IE, it consumes most of any reasonable shortcuts (ctrl combinations, function keys) for own purposes.
        Well, the only iffy thing is to use IE as a browser for applications, but unfortunately, the user out there is the one who makes the decision...
        Last edited by ect; 5 Jul 2009, 23:39.

        Comment


          #5
          Again, browser vendors may decide at any time that the fact that you are subverting a built-in shortcut key represents a security threat, because you can put up UI components that look exactly like the UI the browser would show but in fact do something different.

          If the browser vendors ship an update to the browser that makes it impossible to override a shortcut key that was previously overrideable, your application breaks in production. For this reason it's usually better to pick alternative shortcuts.

          If you really want to pursue taking over as many shortcut keys as you can despite this risk, Isomorphic can do this kind of thing via our service offerings.

          Comment

          Working...
          X