# |
Oct 22nd 2009, 16:39 |
Ceeram |
arz: and even you dont as well |
# |
Oct 22nd 2009, 16:39 |
brookshire |
arz: if you want to reuse it, then use the model |
# |
Oct 22nd 2009, 16:39 |
Ceeram |
but validation should be in model |
# |
Oct 22nd 2009, 16:39 |
Ceeram |
brookshire: indeed doesnt matter where you call it |
# |
Oct 22nd 2009, 16:39 |
dogmatic69 |
brookshire: what does firebug say |
# |
Oct 22nd 2009, 16:38 |
Ceeram |
ok lets put it other wise, could you do the same in just the model, and could you do the same in just the controller without calling User model |
# |
Oct 22nd 2009, 16:38 |
brookshire |
arz: i don't think it matters much if you force the validation in the controller or model, but other disagree obviously |
# |
Oct 22nd 2009, 16:38 |
arz |
ok ... |
# |
Oct 22nd 2009, 16:38 |
sphereweb |
dogmatic69: and back to my initial issue with the ajax form why returning same page as response? |
# |
Oct 22nd 2009, 16:38 |
arz |
so, i'm supposed to do validation by hand inside controller |
# |
Oct 22nd 2009, 16:38 |
Ceeram |
yes from controller indeed |
# |
Oct 22nd 2009, 16:37 |
dogmatic69 |
brookshire: that is logic, not validation |
# |
Oct 22nd 2009, 16:37 |
brookshire |
in that example |
# |
Oct 22nd 2009, 16:37 |
brookshire |
no, you are invalidating it from the controller |
# |
Oct 22nd 2009, 16:37 |
Ceeram |
no you are calling it from the controller, but it still done in the Model |
# |
Oct 22nd 2009, 16:36 |
brookshire |
that is definitely validation |
# |
Oct 22nd 2009, 16:36 |
brookshire |
if (!empty($user['User']['username'])) |
# |
Oct 22nd 2009, 16:36 |
brookshire |
Ceeram: the model, but you're still doing the validation in the controller |
# |
Oct 22nd 2009, 16:36 |
dogmatic69 |
Router::connect( '/contact', array('controller' => 'pages', 'action' => 'display', 'contact' ) ); |
# |
Oct 22nd 2009, 16:36 |
Ceeram |
in UsersController or UserModel? |
# |
Oct 22nd 2009, 16:36 |
dogmatic69 |
sphereweb: i dont know if you can do that... and you are missing a param at the end |
# |
Oct 22nd 2009, 16:36 |
Ceeram |
brookshire: and where do you think invalidate is defined?> |
# |
Oct 22nd 2009, 16:35 |
dogmatic69 |
brookshire: yes, validating from the controller... why you think its last... |
# |
Oct 22nd 2009, 16:35 |
sphereweb |
dogmatic69: I have this in my routes.php: Router::connect('(Login|Terms|Privacy|Contact)', array('controller' => 'pages', 'action' => 'display')); |
# |
Oct 22nd 2009, 16:35 |
brookshire |
$this->User->invalidate('username_unique');//populates tagErrorMsg('User/username_unique') |
# |
Oct 22nd 2009, 16:34 |
dogmatic69 |
check the book... you can make /some/long/cake/path == /contact |
# |
Oct 22nd 2009, 16:34 |
brookshire |
i think it's the last example |
# |
Oct 22nd 2009, 16:34 |
dogmatic69 |
meh |
# |
Oct 22nd 2009, 16:34 |
Ceeram |
brookshire: on what line? |
# |
Oct 22nd 2009, 16:34 |
dogmatic69 |
~routing |
# |
Oct 22nd 2009, 16:34 |
brookshire |
not all validation belongs in the model |
# |
Oct 22nd 2009, 16:33 |
sphereweb |
dogmatic69: i am switching frameworks, so i am rewriting my current live website in CakePHP |
# |
Oct 22nd 2009, 16:33 |
dogmatic69 |
sphereweb: that is where routing comes in handy |
# |
Oct 22nd 2009, 16:33 |
brookshire |
The add form view in /app/views/blog/add.thtml |
# |
Oct 22nd 2009, 16:33 |
Ceeram |
brookshire: what its your point? |
# |
Oct 22nd 2009, 16:33 |
brookshire |
in one of their examples, they perform validation in the controller! |
# |
Oct 22nd 2009, 16:33 |
sphereweb |
dogmatic69: Because my website currently has the conatct page as domain.com/Contact/ and if i use /views/contacts/ i would end up with domain.com/ContactS/ |
# |
Oct 22nd 2009, 16:33 |
arz |
Ceeram, so if there is no save method = no validation? |
# |
Oct 22nd 2009, 16:32 |
Ceeram |
you are getting data from kinda datasource |
# |
Oct 22nd 2009, 16:32 |
brookshire |
Ceeram: http://book.cakephp.org/view/318/Data-Validation |
# |
Oct 22nd 2009, 16:32 |
Ceeram |
arz you vallidate data to save in a datasource |