ajax form field validation in yii

So I have a User model and when someone goes to create a user, I want the username field to turn green if it isn't a duplicate username in the DB and red otherwise stating that duplicate usernames are not allowed. Is there a way to do this with the framework or does this have to be done from scratch?

Answers


I imagine the easiest route would be to create a validation function on the user model which looks it up and returns true or false.

You can then use the usual and well documented methods of setting up a model-form with AJAX validation, and specify username must pass your new validation rule.

If you need more assistance edit your question to give some sense of how far you've get with this, level of knowledge currently and some code if there's something breaking.


Need Your Help

Direct3D C++ texture mapping

c++ directx textures texture-mapping vertex-buffer

Hey guys can anybody help me with texture mapping in Direct3D C++. I have created a basic game and want to texture the enviroment. I have looked at numerous online tutorials but have had no luck so...

Is there any other alternative to template specific exclusion of pages from search

java java-ee search content-management-system cq5

I have restricted some pages like admin pages from not getting visible in search results.Using the below code

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.