Log message #1110804

# At Username Text
# Oct 22nd 2009, 16:47 brookshire arz: override "function save" in your curl model
# Oct 22nd 2009, 16:46 Ceeram no not redirect return false or return null whatever
# Oct 22nd 2009, 16:46 dogmatic69 FMC: if you have required -> true
# Oct 22nd 2009, 16:46 brookshire arz: i see two ways of doing this
# Oct 22nd 2009, 16:46 dogmatic69 arz: if( empty( $data ) ) { redirect } ...continue code... no if
# Oct 22nd 2009, 16:46 Ceeram just make the if statement return, if you dont want any other code to be executed
# Oct 22nd 2009, 16:46 arz but still, is there any way to do this on core level, or just dont bother and do it php way ?
# Oct 22nd 2009, 16:45 FMC does the validation fails if I don't include some inputs in a form ?
# Oct 22nd 2009, 16:44 arz ok, there is no problem to wrap all the controller's code to one large if
# Oct 22nd 2009, 16:43 arz yep
# Oct 22nd 2009, 16:43 Ceeram if(!empty($field))
# Oct 22nd 2009, 16:43 Ceeram arz: only notEmpty?
# Oct 22nd 2009, 16:42 dogmatic69 arz: that is a lot of code to explain over mirc
# Oct 22nd 2009, 16:42 Ceeram http://api.cakephp.org/class/model#method-Modelinvalidate
# Oct 22nd 2009, 16:41 arz Ceeram, well then the question was what to do with this stuff http://bakery.cakephp.org/articles/view/curl-model to make it handle validation
# Oct 22nd 2009, 16:40 Ceeram brookshire: i could call User->invalidates() from any controller, but not without the User model
# Oct 22nd 2009, 16:40 arz brookshire, i think that it touches automagic error generation and other stuff that is automagic , thus it's prefered
# Oct 22nd 2009, 16:40 dogmatic69 untill you need to debug something and now you have validation all over the place
# Oct 22nd 2009, 16:40 Ceeram but this is not really validating what you want, you just want to check if curl returned anything
# Oct 22nd 2009, 16:39 brookshire if it is specific to that one controller, i see no reason not to validate from the controller
# Oct 22nd 2009, 16:39 dogmatic69 you can check the validation in the controller but THE validation code is in the model
# 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?