Wicket
  1. Wicket
  2. WICKET-2424

OnChangeAjaxBehavior + DatePicker do not work together

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.8, 1.5-M1
    • Component/s: wicket, wicket-extensions
    • Labels:
      None
    • Environment:
      Firefox, IE

      Description

      DatePicker fails to notify component update when OnChangeAjaxBehavior is used on the target input.
      It works well with AjaxFormComponentUpdatingBehavior.

      The root cause seems to be in the Wicket.ChangeHandler added by the OnChangeAjaxBehavior, which hides user handler while the DatePicker calls onchange handler directly (wicket-date.js:186):
      if (field.onchange != null && typeof(field.onchange) != 'undefined') field.onchange();

      Possible fix could be dispatching onchange Event instead of direct handler invocation.
      Yet I don't know what is purpose of Wicket.ChangeHandler here...

        Issue Links

          Activity

          Alexey Varlamov created issue -
          Hide
          Juha Paananen added a comment -

          I ran to into the same problem with Wicket 1.4.6. I have a patch for this. The idea of the patch is to save the original "onchange" function of the textfield into "onchangeoriginal" function and then use this function in wicket-date.js:

          wicket-date.js
          + if (field.onchangeoriginal != null && typeof(field.onchangeoriginal) != 'undefined') field.onchangeoriginal();
          wicket-ajax.js
          + obj.onchangeoriginal = obj.onchange;

          Full patch attached.

          Show
          Juha Paananen added a comment - I ran to into the same problem with Wicket 1.4.6. I have a patch for this. The idea of the patch is to save the original "onchange" function of the textfield into "onchangeoriginal" function and then use this function in wicket-date.js: wicket-date.js + if (field.onchangeoriginal != null && typeof(field.onchangeoriginal) != 'undefined') field.onchangeoriginal(); wicket-ajax.js + obj.onchangeoriginal = obj.onchange; Full patch attached.
          Hide
          Juha Paananen added a comment -

          Patch to fix the issue. Created for wicket-1.4.6.

          Show
          Juha Paananen added a comment - Patch to fix the issue. Created for wicket-1.4.6.
          Juha Paananen made changes -
          Field Original Value New Value
          Attachment wicket-2424-patch.txt [ 12437987 ]
          Igor Vaynberg made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Igor Vaynberg [ ivaynberg ]
          Fix Version/s 1.4.8 [ 12314811 ]
          Fix Version/s 1.5-M1 [ 12313078 ]
          Resolution Fixed [ 1 ]
          Martin Grigorov made changes -
          Link This issue relates to WICKET-4204 [ WICKET-4204 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Resolved Resolved
          215d 18h 28m 1 Igor Vaynberg 18/Mar/10 02:17

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development