Tapestry 5
  1. Tapestry 5
  2. TAP5-1844

Datefield not fires onchange event on changes

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.1
    • Fix Version/s: 5.3.3, 5.4
    • Component/s: tapestry-core
    • Labels:
      None

      Description

      It's a "regression" to TAPESTRY-238

      in datefield.js when setting the field's value, onchange() must be called if it exists

        Activity

        Michael Wyraz created issue -
        Hide
        Michael Wyraz added a comment -

        To fix this, in datefeild.js change

        this.field.value = result;

        to:

        if (this.field.value != result)

        { this.field.value = result; if (this.field.onchange) this.field.onchange(); }
        Show
        Michael Wyraz added a comment - To fix this, in datefeild.js change this.field.value = result; to: if (this.field.value != result) { this.field.value = result; if (this.field.onchange) this.field.onchange(); }
        Hide
        Michael Wyraz added a comment -

        Patch for 5.3 Branch:

        Index: tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
        ===================================================================
        — tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js (Revision 1299618)
        +++ tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js (Arbeitskopie)
        @@ -114,7 +114,10 @@
        var date = this.datePicker.getDate();

        var resultHandler = function(result) {

        • this.field.value = result;
          + if (this.field.value != result) { + this.field.value = result; + if (this.field.onchange) this.field.onchange(); + }

        this.hidePopup();

        Show
        Michael Wyraz added a comment - Patch for 5.3 Branch: Index: tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js =================================================================== — tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js (Revision 1299618) +++ tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js (Arbeitskopie) @@ -114,7 +114,10 @@ var date = this.datePicker.getDate(); var resultHandler = function(result) { this.field.value = result; + if (this.field.value != result) { + this.field.value = result; + if (this.field.onchange) this.field.onchange(); + } this.hidePopup();
        Hide
        François Facon added a comment - - edited

        Thanks for the patch Michael, but this.field.onchange is no more implemented in tapestry.js.

        I guess we better have to use event like the following code
        if (this.field.value != result)

        { this.field.value = result; Tapestry.currentFocusField = this.field; //fire an FOCUS_CHANGE_EVENT event to force inputValidation on field document.fire(Tapestry.FOCUS_CHANGE_EVENT, this.field); }

        Regards
        François

        Show
        François Facon added a comment - - edited Thanks for the patch Michael, but this.field.onchange is no more implemented in tapestry.js. I guess we better have to use event like the following code if (this.field.value != result) { this.field.value = result; Tapestry.currentFocusField = this.field; //fire an FOCUS_CHANGE_EVENT event to force inputValidation on field document.fire(Tapestry.FOCUS_CHANGE_EVENT, this.field); } Regards François
        François Facon made changes -
        Field Original Value New Value
        Assignee François Facon [ frafac ]
        François Facon made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        François Facon made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Fix Version/s 5.3.3 [ 12320045 ]
        Fix Version/s 5.4 [ 12316401 ]
        Resolution Fixed [ 1 ]
        Hide
        Hudson added a comment -

        Integrated in tapestry-5.3-freestyle #21 (See https://builds.apache.org/job/tapestry-5.3-freestyle/21/)
        TAP5-1844 : Datefield value must be validated after change (Revision 1325305)

        Result = SUCCESS
        ffacon : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1325305
        Files :

        • /tapestry/tapestry5/branches/5.3/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
        Show
        Hudson added a comment - Integrated in tapestry-5.3-freestyle #21 (See https://builds.apache.org/job/tapestry-5.3-freestyle/21/ ) TAP5-1844 : Datefield value must be validated after change (Revision 1325305) Result = SUCCESS ffacon : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1325305 Files : /tapestry/tapestry5/branches/5.3/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #699 (See https://builds.apache.org/job/tapestry-trunk-freestyle/699/)
        TAP5-1844 : Datefield value must be validated after change (Revision 1325308)

        Result = SUCCESS
        ffacon : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1325308
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #699 (See https://builds.apache.org/job/tapestry-trunk-freestyle/699/ ) TAP5-1844 : Datefield value must be validated after change (Revision 1325308) Result = SUCCESS ffacon : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1325308 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/datefield.js
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open In Progress In Progress
        62d 3h 15m 1 François Facon 12/Apr/12 15:48
        In Progress In Progress Resolved Resolved
        28m 14s 1 François Facon 12/Apr/12 16:16

          People

          • Assignee:
            François Facon
            Reporter:
            Michael Wyraz
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development