Ajax email validation

juliotux 22 Sep, 2012
Hello to everyone.

In the example of realtime email checker using ajax, the errors in the email are reported with colors in the background of the field, like this:

if ( r == 'ok' ) {
email.setStyle('background-color', 'green');
} else {
email.setStyle('background-color', 'red');
}


But I'd like to display errors messages in the place of these color changes. How can I do it? Could anyone help-me?
GreyHead 22 Sep, 2012
Hi juliotux,

Please try this:
if ( r == 'ok' ) {
  $('error-message-email').set('html', 'Everything is OK');
} else {
  $('error-message-email').set('html', 'Something is wrong');
}

You can use both the color and the HTML if you need to.
Bob
This topic is locked and no more replies can be posted.