Log message #1110825

# At Username Text
# Oct 22nd 2009, 16:50 Ceeram validation itself is a proces indeed but should reside within model
# Oct 22nd 2009, 16:50 brookshire validate and invalidate or methods
# Oct 22nd 2009, 16:50 dogmatic69 its a method
# Oct 22nd 2009, 16:49 brookshire Ceeram: all i said was do the validation in the controller... the logic.. validation is a process to me, not a method
# Oct 22nd 2009, 16:49 Ceeram so we do agree
# Oct 22nd 2009, 16:49 Ceeram in the model?
# Oct 22nd 2009, 16:49 Ceeram is there brookshire really?
# Oct 22nd 2009, 16:48 brookshire yes there is :)
# Oct 22nd 2009, 16:48 arz brookshire, there is no such function in model
# Oct 22nd 2009, 16:47 Ceeram yessss
# Oct 22nd 2009, 16:47 dogmatic69 ACTION spelling may be questioned
# Oct 22nd 2009, 16:47 dogmatic69 Ceeram: are you questioning me again
# Oct 22nd 2009, 16:47 Ceeram dogmatic69: yeahyeah
# Oct 22nd 2009, 16:47 arz dogmatic69, sure
# Oct 22nd 2009, 16:47 dogmatic69 P
# Oct 22nd 2009, 16:47 brookshire arz: validate in the controller... use invalidate to throw form errors
# Oct 22nd 2009, 16:47 dogmatic69 Ceeram: in a controller:
# Oct 22nd 2009, 16:47 Ceeram oh damn dogmatic69 yes you are right
# Oct 22nd 2009, 16:47 FMC dogmatic69: then how to set the field to be required and notempty at add, but not at edit ?
# Oct 22nd 2009, 16:47 brookshire or
# Oct 22nd 2009, 16:47 dogmatic69 arz: core is php?
# 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