How to perform custom validation in the semantic interface?

In the semantic interface, I already know that you can validate forms, but there are only certain rules that you can validate. In my registration form (in my application), I want to check if a user exists with a specific email address on the server. If an email exists, the user cannot register with this specific email address. How can i achieve this?

+5
source share
1 answer

You can add your own 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 anchor notation in the settings object.

  rules: [ { type : 'myCustomRule[param]', prompt : 'Custom Error' } ] 

Here is the document Adding a Custom Validation Rule in Semantics

+6
source

Source: https://habr.com/ru/post/1241519/


All Articles