0

I am attempting to create a custom abide validator to check if the username already exists. Everything I find online including here is for foundation 5 and the structure is completely different.

Foundation.Abide.defaults.validators['checkUser'] =
    function($el,required,parent) {
        console.log('checking');
        $.post( "func/checkUsername.php",{'user':$el.val()}, function( data ) {
        if(data.status==1){return true;}
        else{return false;}
        console.log('complete');
    });
};

This is my input field

<input type="text" id="usrnme" name="usrnme" required pattern="checkUser" value="" />

No matter what I do it will not submit to the console and it always comes up invalid.

James
  • 702
  • 2
  • 15
  • 39

1 Answers1

0

pattern="checkUser" change to data-validator="checkUser"

<input type="text" id="usrnme" name="usrnme" required data-validator="checkUser" value="" />
  • 1
    Can you please add more details to your answer? Adding a few lines about what was wrong, and how the solution helps would be nice. – Sahil Singh Aug 09 '17 at 14:26