Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4342

timebox can't be cleared

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.6.3
    • 8.6.2
    • Components
    • Security Level: Jimmy
    • ZK 8.6.3 S1
    • None

      Steps to Reproduce

          <timebox onChange="Clients.log(String.valueOf(event.getValue()) + self.value)"/>
      

      update the value -> blur
      clear the value -> blur
      observe the event and component values logged

      Current Result

      clearing the time results in 12:00am instead of NULL

      Expected Result

      enable clearing the time value, to set a null value at server side

      Debug Info

      this worked in 8.6.1

      Root Cause

      Timebox.coerceFromString doesn't calculate the emptyCount, correctly missing to clear the value

      https://github.com/zkoss/zk/blob/v8.6.2/zul/src/archive/web/js/zul/db/Timebox.js#L164-L184

      possible side effect of ZK-4252 (8.6.2)

      Workaround

      by adding the following script an empty input can be detected -> returning an empty value

          zk.afterLoad('zul.db', function() {
          	var xTimebox = {};
          	zk.override(zul.db.Timebox.prototype, xTimebox, {
          		coerceFromString_ : function(value) {
          		    if(/\d/.test(value)) {
          			    return xTimebox.coerceFromString_.apply(this, arguments);
          		    }
          		    this._changed = false;
              		return;
          		}
          	});//zk.override
          });//zk.afterLoad
      

            rudyhuang rudyhuang
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Time Spent - 2 hours Remaining Estimate - 2 hours
                2h
                Logged:
                Time Spent - 2 hours Remaining Estimate - 2 hours
                2h