PDA

View Full Version : how to check user availability while developing registration form



ibcravi
25 Aug 2009, 1:49 AM
Hi

i am developing a registration form .
in that i need to provide a provision to the user to choose user name that is not exists in the database. as soon as user moves to the other page we need to show whether the username is exist or not .
how can i achieve this through extjs frame work

plz help me

Ravi

mitchellsimoens
25 Aug 2009, 10:01 AM
So you have a registration form and once someone types in a username and goes on you want to check the database to see if that username is free?

On the textfield you could simply add a "blur" listener and use an AJAX request to return true (if it's free) or false (if it's taken).

BitPoet
25 Aug 2009, 10:19 AM
If it's a real ExtJS form, you can simply do a getForm().submit and, if the name is already taken, return a JSON object as explained in Ext.form.Action.Submit (http://www.extjs.com/deploy/dev/docs/?class=Ext.form.Action.Submit) outlining the error:


{
success: false,
errors: {
username: "This username is already taken!"
}
}

Ajax validation, though often seen, isn't reliable due to its asynchronuous nature. The user might already click the 'Submit' button before the validation request has come back.