Hi there,
Is there a way in which we can programmatically call validation on a specific field through Javascript?
I have a form which performs a username and email check http://mtn.transcend-intl.com/index.php/join-us on a current development site; the check itself goes great however, I would like to perform the Javascript validation prior to performing the GET call.
I'm not even sure what validation engine is being used here so and documentation on hooks is completely absent. Here's the snippet I use:
Is there a way in which we can programmatically call validation on a specific field through Javascript?
I have a form which performs a username and email check http://mtn.transcend-intl.com/index.php/join-us on a current development site; the check itself goes great however, I would like to perform the Javascript validation prior to performing the GET call.
I'm not even sure what validation engine is being used here so and documentation on hooks is completely absent. Here's the snippet I use:
var intPass = 0;
$('#submit').attr('disabled', 'disabled');
$('#username').blur( function(e) {
/* I WOULD LIKE TO CALL CHRONOFORMS VALIDATION HERE */
var username = $('#username').val();
if ( username != '' ) {
var url = 'index.php?option=com_chronoforms&chronoform=ajaxcheck&username='+username+'&tmpl=component';
$.get(url, function(data) {
parseResult(data, 'username');
});
}
});
function parseResult(request, strElementID) {
var objElement = $('#'+strElementID);
objElement.removeClass('border-ok border-error');
var msg = request.split('##@##');
if(msg[0] === 'OK') {
intPass++;
objElement.addClass('border-ok');
if(intPass == 2) {
$('#submit').removeAttr('disabled');
}
} else {
intPass--;
$('#submit').attr('disabled', 'disabled');
objElement.addClass('border-error');
}
}