Elgg Registration page Validations

Can any one explain how the server side validation messages in Registration page is displayed from actions/register.php..?

I mean When i used jquery for server side validations as following

$.ajax
({
type: 'POST',
url: $('#register').attr('action'),
data: $('#register').serialize(),
success: function(data)
{
$('#ermessages').html(data);
}
});

Iam getting these output also with correct error messages..

{"output":"","status":-1,"system_messages":{"error":["Please enter a valid Name" "],"success":[]}}

What is the cause of this problem, Your help is highly appreciated

  • register_error() and system_message() display those messages. There's a server side ajax action handler that is responsible for formatting the json response.

    You should probably use one of the built in Elgg JS functions to submit actions, or at the very lease the bundled jQuery form plugin. Look at elgg.action() in js/lib/ajax.js, which will handle a lot of stuff for you.

    The cause of the error is that there's missing fields in the submitted data.