I'm using PaperInput and like the feel. But, is there a way to do the validation using my own logic? For instance, in some cases a pattern match is not enough to determine the error I'd like to display. An example would be I want the PaperInput to specify an item which can only be added once, so the validation would do a lookup in some model map and if input.inputValue is not present it is valid, otherwise invalid.
<paper-input floatingLabel
id="alias-input"
validate="{{aliasIsValid}}"
type="text"
error="{{aliasError}}"
label="Person Alias (eg: King, Eldest Son, Mooch, etc.)"
required
></paper-input>
So, I would like to be able to implement bool aliasIsValid() and set @observable String aliasError when validation is invalid. I do not think this is how it works, but is there a way to achieve this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…