Using the Bootstrap validator
remote
, fields are validated successfully. How can you then have a conditional statement if valid
is true to perform a certain action and if false then do something else. This is my validator:
agentPwd:{
validators :{
remote : {
url : '/agent',
data : function(validator) {
return {
agentPwd : validator.getFieldElements('agentPwd').val()
};
},
message : 'Invalid user and/or password',
},
}
},
I want to know how can an if-else
statement will fit into here, such as one below:
if(valid === true){
alert('success'),
}else{
alert('fail'),
}
There are various events you can listen to, such as success.form.bv
or error.form.bv
.