Ioan-Catalin B. Sun Sep 23 09:49:17 -0400 2012

Subject: ActiveRecord using Validate Class.

[b] I don't know why my first PHP Quote looks wrong. Try citing me and the code looks.. correct.

So i can't use the Validate class (like instanciating it and use with it's documents) becouse i must have a instance of Model class. Okey..
here's what I want.
I want a multiple validation to a form. So I can process multiple requests for multiple fields. For example let's see we are in "username" field.. and typing. The browser responds and says if the username is taken or not. And so on and so on. But I would do that by:
if( strlen($username) == 0 ||
strlen($username) > 30 ||
strlen($username) < 3 ) {
echo json_encode(array('valid' => false));
else { {
$user = \AR\Models\User::find('first', array('conditions', array('username = ?', $username))); {
echo json_encode(array('valid' => false));

if($user === null)
echo json_encode(array('valid' => false));
else {
echo json_encode(array('valid' => true));

Does that even make sense? Cuz it is crucial for not checking validation every time I try this validation ( although I may or may NOT save it in my database).