Wicket
  1. Wicket
  2. WICKET-1535

ExternalLink JavaScript not working in FF 3

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.3.3
    • Fix Version/s: 1.3.5, 1.4-RC1
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      WinXP; Firefox 3.0 Beta 5

      Description

      If the link target isn't a proper anchor, the code generates a JS on-click handler, i.e.
      tag.put("onclick", "window.location.href='" + url + "';");
      which generates code such as
      onclick='window.location.href="http://news.bbc.co.uk";'

      The problem is that when this is used with a button /in a form/, while this works with IE & FF2, it appears that FF3 needs a 'return false;' at the end of the JS before it works, otherwise it just treats the button as a 'submit' action.

      So, is there any down-side to changing the above line in
      \org\apache\wicket\markup\html\link\ExternalLink.java
      to be
      tag.put("onclick", "window.location.href='" + url + "'; return false;"); ?

      /Gwyn

        Activity

        Igor Vaynberg made changes -
        Fix Version/s 1.3.5 [ 12313175 ]
        Resolution Fixed [ 1 ]
        Assignee Igor Vaynberg [ ivaynberg ]
        Status Open [ 1 ] Resolved [ 5 ]
        Martijn Dashorst made changes -
        Fix Version/s 1.4-M3 [ 12312912 ]
        Fix Version/s 1.4-M4 [ 12313295 ]
        Frank Bille Jensen made changes -
        Fix Version/s 1.4-M3 [ 12312912 ]
        Fix Version/s 1.4-M2 [ 12312911 ]
        Frank Bille Jensen made changes -
        Fix Version/s 1.3.4 [ 12313089 ]
        Fix Version/s 1.4-M2 [ 12312911 ]
        Fix Version/s 1.4-M1 [ 12312523 ]
        Gwyn Evans made changes -
        Fix Version/s 1.4-M1 [ 12312523 ]
        Description If the link target isn't a proper anchor, the code generates a JS on-click handler, i.e.
           tag.put("onclick", "window.location.href='" + url + "';");
        which generates code such as
          onclick='window.location.href="http://news.bbc.co.uk";'

        The problem is that when this is used with a button in a form, while this works with IE & FF2, it appears that FF3 needs a 'return false;' at the end of the JS before it works, otherwise it just treats the button as a 'submit' action.

        So, is there any down-side to changing the above line in
          \org\apache\wicket\markup\html\link\ExternalLink.java
        to be
          tag.put("onclick", "window.location.href='" + url + "'; return false;"); ?

        /Gwyn
        If the link target isn't a proper anchor, the code generates a JS on-click handler, i.e.
           tag.put("onclick", "window.location.href='" + url + "';");
        which generates code such as
          onclick='window.location.href="http://news.bbc.co.uk";'

        The problem is that when this is used with a button /in a form/, while this works with IE & FF2, it appears that FF3 needs a 'return false;' at the end of the JS before it works, otherwise it just treats the button as a 'submit' action.

        So, is there any down-side to changing the above line in
          \org\apache\wicket\markup\html\link\ExternalLink.java
        to be
          tag.put("onclick", "window.location.href='" + url + "'; return false;"); ?

        /Gwyn
        Gwyn Evans made changes -
        Field Original Value New Value
        Priority Major [ 3 ] Minor [ 4 ]
        Gwyn Evans created issue -

          People

          • Assignee:
            Igor Vaynberg
            Reporter:
            Gwyn Evans
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development