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

Datebox is not updated properly when enter pressed in inner timebox

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 7.0.2
    • 7.0.0
    • None
    • Security Level: Jimmy
    • None

      Reproduce:
      Use the code below:

      <zk>
      	<datebox id="db" cols="20" format="yyyy/MM/dd a hh:mm:ss"  onCreate="self.value = new Date()" />
      </zk>
      

      1. Open calendar of datebox
      2. Click hour of inner timebox
      3. Click up arrow of inner timebox to change hour
      4. Press Enter key

      then the hour changed back to old value.

      Cause:
      this line https://github.com/zkoss/zk/blob/master/zul/src/archive/web/js/zul/db/Datebox.js#L396

      this._pop.doKeyDown_(evt);
      

      triggered clickDate and rever the value before

      this.enterPressed_(evt);
      

      Workaround:
      Restore value manually as below:

      <zk xmlns:w="client">
      	<datebox id="db" cols="20" format="yyyy/MM/dd a hh:mm:ss"  onCreate="self.value = new Date()">
      		<attribute w:name="_doKeyDown"><![CDATA[
      			function (evt) {
      				if (evt.keyCode == 13 && evt.target == this._tm) // Enter from inner timebox
      					var _tmpValue = this.getInputNode().value;
      				this.$_doKeyDown(evt);
      				if (_tmpValue)
      					this.getInputNode().value = _tmpValue;
      			}
      		]]></attribute>
      	</datebox>
      </zk>
      

            noahhuang noahhuang
            benbai benbai
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: