In Semantic UI, I already know that you can validate forms, but there are only certain rules you can validate. In my signup form (in my application), I want to check if a user with a certain email already exists in the server. If the email exists, the user cannot signup with that certain email. How would I achieve this?
You can add custom validation rules to your form.
$.fn.form.settings.rules.myCustomRule = function(param) {
// Your validation condition goes here
return (param <= 10 )? true : false;
}
To pass parameters to a rule, use bracket notation in your settings object.
rules: [
{
type : 'myCustomRule[param]',
prompt : 'Custom Error'
}
]
Here is the doc Adding custom validation rule in semantic
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With