This page is only accessible by Rail cluster members.
Please note, adding new topics is restricted to Admins and Rail Organisations.If you think that applies to you and you are seeing this message in error, email [email protected].
Log in
Register
// Do inline validation for username
jQuery(document).ready(function($) {
$(this).parents('form').find('#ctdb_user_form-response').hide();
// On focusout so that we only evaluate inputs once completed
// Send current so that we only evaluate current input
$('#ctdb-registration-wrap input').on('focusout', function() {
$(this).parents('form').find('#ctdb_user_form-response').hide();
var required = 'false';
if ($(this).hasClass('required')) {
required = 'true';
}
// Clear the field validation each time
var validateID = $(this).attr('id');
$(this).removeClass('valid invalid');
$('#' + validateID + '-response').html('');
var data = {
'action': 'ajax_validation',
'current': $(this).attr('id'),
'val': $(this).val(),
'required': required,
'login': $('.ctdb_user_login').val(),
'email': $('#ctdb-registration-wrap #ctdb_user_email').val(),
'pass': $('#ctdb-registration-wrap #ctdb_user_pass').val(),
'confirm': $('#ctdb-registration-wrap #ctdb_user_pass_confirm').val(),
'security': "a2852692b4",
'dataType': 'json'
};
$.post(ajaxurl, data, function(response) {
response = JSON.parse(response);
for (var i = 0; i < response.length; i++) {
if (response[i]['status'] == 'error') {
var id = response[i]['id'];
$('.' + id).removeClass('valid');
$('.' + id).addClass('invalid');
$('#' + id + '-response').html(' - ' + response[i]['message'] + '');
} else if (response[i]['status'] == 'ok') {
var id = response[i]['id'];
$('.' + id).removeClass('invalid');
$('.' + id).addClass('valid');
if (response[i]['message']) {
$('#' + id + '-response').html(' - ' + response[i]['message'] + '');
} else {
$('#' + id + '-response').html('');
}
}
}
});
});
$('#ctdb_registration_form').submit(function(event) {
if ($(this).find('input.invalid').length > 0) {
$(this).find('#ctdb_user_form-response').show();
event.preventDefault();
}
});
});


