Input validation


#1

Could someone point me in the right direction for input validation of fields in a plugin. Thanx in advance. I’d like to have the same popup-tip behavior as a missing required field in the post composer.

/david


(Alan Tan) #2

Have a look at

  1. discourse/input-tip.js.es6 at master · discourse/discourse · GitHub
  2. discourse/popup-input-tip.js.es6 at master · discourse/discourse · GitHub

Basic usage is something like

# In your templates
{{popup-input-tip validation=<some computed property to show/hide the tip>}}
{{input-tip validation=<some computed property to show/hide the tip>}}

#3

I have tried this and it works great for validating a property continuously while writing. However, I would like to just check if it is set when I press save. Could I trigger the validation in an event action somehow?