How to make a pre-existing email or username confirmation in ui semantics form?

Hi, I am new to ui semantic structure and I want to check if the email already exists or the username already exists. So what I do, I created my own rule and run ajax to check the email or username already existing or not .... Please check the below code. email already exists

email: {
    identifier: 'email',
    rules: [{
            type: 'email',
            prompt: 'Please enter a valid e-mail'
        },
        {
            type: 'alreadyExistemail',
            prompt: 'This email is already registered, please choose another one.'
        }
    ]
}
$.fn.form.settings.rules.alreadyExistemail = function(param) {
    return Check_existence(param);
}

function Check_existence(param) {
    //Here I am running ajax which is communicating with db and returning true or false.
     var a;
      $.ajax({
            method: "POST",
            url: ajax_url,
            async:false,
            data: { 'action': 'checkEmailalreadyexist','email':param},
            success: function (data) {
                a = data;
            }
        });
        return a;

}

      

But the problem is that Ajax works with each individual alphabet and I want (for a specific field) it must first be validated by another rule and then work with the custom rule functionality. so this is possible, I can test another rule in effect in a custom rule like

$.fn.form.settings.rules.alreadyExistemail = function(param) {
    if (is valid(email)) {
        return Check_existence(param);
    }
}

      

or can anyone suggest how I can make a check, for example, that the mail already exists or the username already exists in the semantic form ui?

+3
javascript php semantic-ui


source to share


No one has answered this question yet

See similar questions:

5129
How do I return a response from an asynchronous call?

or similar:

4270
Link. What does this symbol mean in PHP?
3998
How to validate an email address in JavaScript
3515
How do I make the first letter of a string uppercase in JavaScript?
1192
How do I redirect in PHP?
1065
Link. What does this error mean in PHP?
836
How to fix "Headers already sent" error in PHP
597
Create a folder if it doesn't already exist.
five
How do I spot check the semantic interface?
0
CodeIgniter - checking username and email not working
0
Check if username and email are not in my database



All Articles
Loading...
X
Show
Funny
Dev
Pics