Search code examples
dartdart-polymerpaper-elementscore-elements

How to listen on an on-input-valid paper-input property


Please consider the following snippet:

<paper-input floatinglabel required
  id="title"
  class=''
  label="Title"
  value='{{name.title}}'
  validate='^[A-Za-z'\s-]*$'
  error="Only letters are allowed"
  on-input-valid='{{validInputHandler}}'>
</paper-input>

 void validInputHandler() {
    print( 'valid input' );
  }

Although the input is valid for a letter, the validInputHandler is not being triggered.

Reading the docs here http://www.polymer-project.org/docs/elements/core-elements.html#core-input

suggest I am on the correct path but the validInputHandler does not prints anything.


Solution

  • It seems the input-valid event was added later and is not yet contained in Dart core-elements (paper-input extends core-input).

    Currently only input-invalid is supported in Dart.

    See also Taking total control of PaperInput validation for an example about custom validation.