-
Notifications
You must be signed in to change notification settings - Fork 7
Data Validation
Will Fuchs edited this page Jan 9, 2020
·
1 revision
Data validation can be accomplished by using the validator
option as below.
var tags = [{
type: "input",
tag: "text",
name: "name",
"chat-msg": "What is 1 + 1?",
validator: function(input) {
return input == "2" || input.toUpperCase() === "TWO"
},
invalid: "Hmm... That's not what I got!"
}]
validator
gets passed the input (text, value of selection, custom input, etc) and must return true or false. On false, the invalid
option message is displayed, or, if none is provided, the default 'Invalid input' will be displayed.