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

SimpleConstraint created by flag causes JS error

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 8.5.1, 8.6.0.1
    • Fix Version/s: 8.6.1
    • Component/s: Components
    • Security Level: Jimmy
    • gh.sprint.customfield.default.name:
      ZK 8.6.1 S1

      Description

      Steps to Reproduce

      <zk>
        <zscript><![CDATA[
          Constraint constraintByString = new SimpleConstraint("no empty");
          Constraint constraintByFlag = new SimpleConstraint(SimpleConstraint.NO_EMPTY);
        ]]></zscript>
        working constraint <datebox constraint="${constraintByString}" />
        <separator/>
        failing constraint <datebox constraint="${constraintByFlag}" /> (leaving empty produces JS error)
      </zk>
      

      focus, then blur the dateboxes

      Current Result

      first datebox shows a wrong value message
      second datebox causes a JS error

      zul.inp.wpd:1464 Uncaught TypeError: Cannot read property 'length' of undefined
          at init._init (zul.inp.wpd:1464)
          at init.validate (zul.inp.wpd:1585)
          at init.validate_ (zul.inp.wpd:639)
          at init._validate (zul.inp.wpd:666)
          at init.updateChange_ (zul.inp.wpd:744)
          at init.$supers (zk.wpd:11786)
          at init.updateChange_ (zul.inp.wpd:2037)
          at init.$supers (zk.wpd:11786)
          at init.updateChange_ (zul.db.wpd:3374)
          at init.doBlur_ (zul.inp.wpd:479)
      

      Expected Result

      working constraint validation in both cases, no JS error

      Debug Info

      Root Cause

      side effect of ZK-3527

      Workaround

      	<script><![CDATA[
      	zk.afterLoad('zul.inp', function() {
      		var xSimpleConstraint = {};
      		zk.override(zul.inp.SimpleConstraint.prototype, xSimpleConstraint, {
      			reparseConstraint : function() {
      				if(this._cst) {
      					return xSimpleConstraint.reparseConstraint.apply(this, arguments);
      				}
      			}
      		});//zk.override
      	});//zk.afterLoad
      	]]></script>
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                rudyhuang rudyhuang
                Reporter:
                cor3000 cor3000
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h