Benoit
Benoit

Reputation: 486

validateOptions gets error

The validateOptions clienthandler option doesn't work. It gives always an error. Is there smth wrong with this method ?

function doGet() {
  var mc = new Array();
  mc[0]='h';
  mc[1]='ho';
  mc[2]='hou';
  mc[3]='hous';
  mc[4]='house';
  var app = UiApp.createApplication();
  var rech = app.createTextBox();
  var result = app.createLabel('Match').setVisible(false);
  var ch = app.createClientHandler().validateOptions(rech, mc).forTargets(result).setVisible(true);
  rech.addKeyUpHandler(ch);
  app.add(rech);
  app.add(result);
  return app;
}

Upvotes: 0

Views: 191

Answers (1)

Henrique G. Abreu
Henrique G. Abreu

Reputation: 17792

There's definitely something wrong with it. I can always reproduce this problem as well, and you code seems fine. You should open a report on Apps Script issue tracker.

By the way, as a workaround until they solve it. You can always use the validateMatch method as a replace of validateOptions, it's just more difficult for those who don't know regex. Here's an example using your snippet:

var ch = app.createClientHandler().validateMatches(rech, '^h(o(u(se?)?)?)?$').forTargets(result).setVisible(true);

Upvotes: 2

Related Questions