0

Java Script error zk.wpd in Explorer

asked 2014-04-30 12:07:58 +0800

inforalv gravatar image inforalv
3 1

updated 2014-04-30 12:08:32 +0800

Hellooo!! I work with zk version 6.5.2 I would like avoid validation before submit and I have tryed this solution:

The code noValidateOnBlur.js that I have used is:

zk.afterLoad("zul.inp", function () {
  zk.$package("zul.inp").TextboxNoErrorOnCtrlKey = zk.$extends(zul.inp.Textbox, {
    doBlur_: function (event) {
      this.getConstraint().getFlags().NO_EMPTY=false;
      this.$supers("doBlur_", event); //FAIL THIS LINE
      this.getConstraint().getFlags().NO_EMPTY=true;
    }
  });
});

and the .zul:

<zk xmlns:w="client">
  <?script type="text/javascript" src="/js/noValidateOnBlur.js" ?>
  <window>
    <textbox w:use="zul.inp.TextboxNoErrorOnCtrlKey" id="tbCompany" hflex="1"   constraint="no empty"/>
  </window>
</zk>

It's working well for me in Chrome but when I execute in Explorer and move out the text fails in line .js(noted aboved)

Message: An object array or arguments were expected 
Line: 9 
Character: 9732 
Code: 0 
URI: /myportal/zkau/web/439b83ff/js/zk.wpd

What is wrong? Thanks in advance (Sorry for my bad English)

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2014-05-01 04:03:58 +0800

cor3000 gravatar image cor3000
6280 2 7

updated 2014-05-01 04:08:17 +0800

It should be (see API docs)

this.$supers("doBlur_", arguments); //THIS LINE SHOULD NOT FAIL

arguments is an implicit variable in JS that contains all the arguments of the current method call, and so it is easy and save to pass the arguments on to the overridden method.

If you want to pass the arguments explicitly you can use $super() instead of $supers()

I don't know why it works in chrome... anyway the correct usage is with an array of arguments.

Robert

link publish delete flag offensive edit
0

answered 2014-05-07 15:23:15 +0800

inforalv gravatar image inforalv
3 1

Ok! It's true. The correct code could be:

zk.afterLoad("zul.inp", function () {
  zk.$package("zul.inp").TextboxNoErrorOnCtrlKey = zk.$extends(zul.inp.Textbox, {
    doBlur_: function (event) {
      this.getConstraint().getFlags().NO_EMPTY=false;
      this.$super("doBlur_", event);
      this.getConstraint().getFlags().NO_EMPTY=true;
    }
  });
});

In case of someone is interested I have worked with no validation onBlur and the code is just like this:

zk.afterLoad("zul.inp", function () {
  zk.$package("zul.inp").TextboxNoErrorOnCtrlKey = zk.$extends(zul.inp.Textbox, {
    doBlur_: function (event) {
      this.getConstraint().getFlags().NO_EMPTY=false;
      this.$super("doBlur_", event);
      this.getConstraint().getFlags().NO_EMPTY=true;
    }
  });
});

zk.afterLoad("zul.db", function () {
  zk.$package("zul.db").DateboxNoErrorOnCtrlKey = zk.$extends(zul.db.Datebox, {
    doBlur_: function (event) {
      var aux = this.getConstraint();
      var arrayConstraints = this.getConstraint().split(",");
      var strWithoutNoEmpty = "";
      for (var i = 0; i < arrayConstraints.length; i++) {
          if (arrayConstraints[i].indexOf("no empty") == -1) {
              strWithoutNoEmpty += arrayConstraints[i] + ",";
          }
      }
      if (strWithoutNoEmpty.length > 0) {
          strWithoutNoEmpty = strWithoutNoEmpty.substring(0, strWithoutNoEmpty.length - 1);
      }
      this.setConstraint(strWithoutNoEmpty); 
      this.$super("doBlur_", event); 
      this.setConstraint(aux);
    }
  });
});

zk.afterLoad("zul.inp", function () {
  zk.$package("zul.inp").ComboboxNoErrorOnCtrlKey = zk.$extends(zul.inp.Combobox, {
    doBlur_: function (event) {
      this.getConstraint().getFlags().NO_EMPTY=false;
      this.$super("doBlur_", event); 
      this.getConstraint().getFlags().NO_EMPTY=true;
    }
  });
});

Thank you Rober!

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-04-30 12:07:58 +0800

Seen: 30 times

Last updated: May 07 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More