Re: Data validation before submit
Thanks Sam. I think i'll settle on jquery validation. i hope cake integrates jquery validation. On Aug 28, 2:56 am, Sam s...@masterscommission360.com wrote: In the past I've used ajax to send fields to the controller to validate as they are changed- it is a bit slower than full client-side validation but is way easier to maintain. On Aug 27, 8:34 am, sanedevil sanede...@gmail.com wrote: ah! sorry. i wanted to ask regarding client-side form validation. apparently, this can't be done with cake. if it can be, please lemme know how. On Aug 27, 8:25 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: See:http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller if ($this-Model-validates()): or, from within the model of the data you want to validate... if ($this-validates()): Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 26 Aug 2010, at 22:39, sanedevil wrote: heya! is there a way to validate the data before submission using Cake? Thanks! Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en-Hidequoted text - - Show quoted text - Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Data validation before submit
ah! sorry. i wanted to ask regarding client-side form validation. apparently, this can't be done with cake. if it can be, please lemme know how. On Aug 27, 8:25 am, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: See:http://book.cakephp.org/view/1182/Validating-Data-from-the-Controller if ($this-Model-validates()): or, from within the model of the data you want to validate... if ($this-validates()): Jeremy Burns Class Outfit jeremybu...@classoutfit.comhttp://www.classoutfit.com On 26 Aug 2010, at 22:39, sanedevil wrote: heya! is there a way to validate the data before submission using Cake? Thanks! Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en- Hide quoted text - - Show quoted text - Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Data validation before submit
heya! is there a way to validate the data before submission using Cake? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Intercept each request
hi all, Is there a way in cake to intercept every request, check if the request is from a logged in user and then direct him/her accordingly? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: HABTM and Pagination
Hi Walt, Few days back I had a similar issue. I tried everything. In the end, there was just one thing that worked for me - Custom Joins. http://book.cakephp.org/complete/1000/Models#Joining-tables-1047 HTH On Aug 21, 2:16 am, Walt walt.norb...@gmail.com wrote: Hello Everone, Perhaps I'm daft. I find folks that have similar issues, but none seem to be as direct as I need it to be. I'm trying to write a simple search, but the HABTM relationship I have seems to be getting in the way. I have three models in the search: Person, Role, and Institution. Person HABTM Role Person Belongs to Institution In my controller, I've built my conditions like this: $this-Person-recursive = 2; $contain = array( 'Institution', 'Role' ); $this-paginate = array( 'limit' = 10, 'order' = array('Person.username' = 'asc'), ); $conditions = array( 'Person.username LIKE' = '%'.$username.'%', 'Person.department LIKE' = '%'.$department.'%', 'Person.email LIKE' = '%'.$email.'%', 'Institution.id' = $institutionId, 'Role.id' = $roleId, ); $this-set('people', $this-paginate('Person',$conditions)); The above code works if I omit the Role criteria. Since I would only like to search for people with certain roles, I really do need that extra bit. With the Role criteria, I recieve the following error, which seems consistent with something hairy going on with the HABTM I have set up: Unknown column 'Role.id' in 'where clause' Could someone point me to a decent solution. It seems like this should have been worked out before. I sincerely appreciate any help you can offer. Thanks, Walt Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Change the File Name for a Model
You are rite! thanks! On Aug 16, 8:15 pm, Miles J mileswjohn...@gmail.com wrote: Why are you using App::import()? Just use the ole regular include_once. On Aug 14, 3:13 pm, sanedevil sanede...@gmail.com wrote: Thanks again guys! @AD7six, i checked the app::import, but couldn't figure out a way that will help me. can u pls enlighten me? On Aug 13, 4:31 pm, AD7six andydawso...@gmail.com wrote: On Aug 13, 4:19 pm, sanedevil sanede...@gmail.com wrote: Thanks all guys! seems i cant achieve what i want. I'll change the class name and make the changes elsewhere in the app. as a sidenote (and a general query), cake stresses on convention over configuration, but doesn't it provide configuration for the desperate and crazy cases (like me ;-) )? Ps if your model class is named Con *only* because the db table is named cons - then just useTable your way out of that paper bag. Pps - filenames should be lower case. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
HABTM with Containable
Users HABTM Profiles: I have 2 users: userone: id = 3 usertwo: id = 4 and 2 profiles: public: id = 3 private: id = 4 userone belongs to public profile usertwo belongs to private profile I'm using Containable behavior. I want the User details if the user belongs to a 'Public' Profile. Here's what I have $users = $this-User-find('all', array( 'fields' = array('User.name'), 'contain' = array( 'Profile' = array( 'conditions' = array('Profile.name' = 'Public') )), 'recursive' = 2 )); However, its giving me this in debug: Array ( [0] = Array ( [User] = Array ( [name] = userone [id] = 3 ) [Profile] = Array ( [0] = Array ( [id] = 3 [name] = Public [UsersProfile] = Array ( [id] = 3 [pro_id] = 3 [user_id] = 3 ) ) ) ) [1] = Array ( [User] = Array ( [name] = usertwo [id] = 4 ) [Profile] = Array ( ) ) ) I expect only userone to be displayed and not usertwo. Am I doing anything wrong? thanks! KS Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Change the File Name for a Model
Thanks again guys! @AD7six, i checked the app::import, but couldn't figure out a way that will help me. can u pls enlighten me? On Aug 13, 4:31 pm, AD7six andydawso...@gmail.com wrote: On Aug 13, 4:19 pm, sanedevil sanede...@gmail.com wrote: Thanks all guys! seems i cant achieve what i want. I'll change the class name and make the changes elsewhere in the app. as a sidenote (and a general query), cake stresses on convention over configuration, but doesn't it provide configuration for the desperate and crazy cases (like me ;-) )? Ps if your model class is named Con *only* because the db table is named cons - then just useTable your way out of that paper bag. Pps - filenames should be lower case. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Change the File Name for a Model
Thanks all guys! seems i cant achieve what i want. I'll change the class name and make the changes elsewhere in the app. as a sidenote (and a general query), cake stresses on convention over configuration, but doesn't it provide configuration for the desperate and crazy cases (like me ;-) )? On Aug 13, 10:03 am, euromark dereurom...@googlemail.com wrote: that's what i was wondering :) On 13 Aug., 09:31, AD7six andydawso...@gmail.com wrote: On Aug 13, 12:03 am, sanedevil sanede...@gmail.com wrote: Table name: cons Class name: Con File name: Con.php However, windows doesn't allow you to create a file named Con. Is there a way that I can change the filename (e.g. Contact.php), but still keep the Classname as Con? Thanks! An odd windows problem But why do you want to give a model a name that doesn't mean anything?- Hide quoted text - - Show quoted text - Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Change the File Name for a Model
Table name: cons Class name: Con File name: Con.php However, windows doesn't allow you to create a file named Con. Is there a way that I can change the filename (e.g. Contact.php), but still keep the Classname as Con? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Change the File Name for a Model
And i thot it would be something simple. Damn it! thanks euromark! the table's already called Con and hence want to keep the name consistent throughout the app to avoid the typical issues that a softie faces :) You can imagine the nightmare when I start using two names in the app. I really hope theres a way out. On Aug 13, 12:14 am, euromark dereurom...@googlemail.com wrote: WOW didnt know that.. crazy :) this would not be very straight forward. maybe with manual includes and stuff but why not naming it Contact and contact.php? On 13 Aug., 00:03, sanedevil sanede...@gmail.com wrote: Table name: cons Class name: Con File name: Con.php However, windows doesn't allow you to create a file named Con. Is there a way that I can change the filename (e.g. Contact.php), but still keep the Classname as Con? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: HABTM Saving
thanks, but this dint work as well :( i can link one Profile to the user at a time, but not more than one :( is there any other specific setting that i need to take care of? On Jul 28, 3:40 am, DCrews cre...@gmail.com wrote: if $this-data is structured like the following: array( ['User'] = array( 'id' = xxx ), ['Profile'] = array( [0] = array( 'id' = xxx, 'whatever' = whatever, etc... [1] = array( 'id' = xxx, 'whatever' = whatever, etc... ) ) and you have HABTM in your models, you can do $this-User-saveAll($this-data); And it'll save them all. I haven't tried anything like saving multiple users all at once each with multiple profiles, but I imagine it'd require setting the recursive up a little, but still doable. On Jul 27, 5:13 pm, sanedevil sanede...@gmail.com wrote: Thanks Norman, However, it dint work :( The problem is that I can't save multiple links of Profile and User. I can only do one at a time. hence, $data['Profile']['id'] = 1234 works, but $data['Profile'][0] ['id'] = 1234 doesn't work :( any lights? On Jul 27, 1:15 am, Norman Paniagua normanpania...@gmail.com wrote: Try $data['User']['id'] = 1010; $data['Profile'][0]['id'] = 1234; $data['Profile'][1]['id'] = 5678; foreach ($data['Profile'] as $i=$v): $data['Profile'][$i]['user_id'] = $data['User']['id']; endforeach; $this-User-save($data); $this-User--Profile-saveAll($data); I dont know if doing $this-User-saveAll($data) will save the User and Profile data --- Norman Paniagua 2010/7/26 sanedevil sanede...@gmail.com For my problem, a User HABTM Profiles A user can select multiple profiles via a screen. I get these values in my controller. I want to link all these profiles with the user. Currently i'm doing: $profile_1['Profile']['id'] = 1234; //the profile id $profile_1['User']['id'] = 1010; // The user id $this-User-save($profile_1); $profile_2['Profile']['id'] = 5678; //the profile id $profile_2['User']['id'] = 1010; // The user id same as before $this-User-save($profile_2); However, this creates only the 2nd link in the HABTM table. Is there a way that I can create both the links (1010-1234 and 1010-5678) in a single shot? Thanks! Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en-Hide quoted text - - Show quoted text - Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: HABTM Saving
Thanks Norman, However, it dint work :( The problem is that I can't save multiple links of Profile and User. I can only do one at a time. hence, $data['Profile']['id'] = 1234 works, but $data['Profile'][0] ['id'] = 1234 doesn't work :( any lights? On Jul 27, 1:15 am, Norman Paniagua normanpania...@gmail.com wrote: Try $data['User']['id'] = 1010; $data['Profile'][0]['id'] = 1234; $data['Profile'][1]['id'] = 5678; foreach ($data['Profile'] as $i=$v): $data['Profile'][$i]['user_id'] = $data['User']['id']; endforeach; $this-User-save($data); $this-User--Profile-saveAll($data); I dont know if doing $this-User-saveAll($data) will save the User and Profile data --- Norman Paniagua 2010/7/26 sanedevil sanede...@gmail.com For my problem, a User HABTM Profiles A user can select multiple profiles via a screen. I get these values in my controller. I want to link all these profiles with the user. Currently i'm doing: $profile_1['Profile']['id'] = 1234; //the profile id $profile_1['User']['id'] = 1010; // The user id $this-User-save($profile_1); $profile_2['Profile']['id'] = 5678; //the profile id $profile_2['User']['id'] = 1010; // The user id same as before $this-User-save($profile_2); However, this creates only the 2nd link in the HABTM table. Is there a way that I can create both the links (1010-1234 and 1010-5678) in a single shot? Thanks! Check out the new CakePHP Questions sitehttp://cakeqs.organd help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.comcake-php%2bunsubscr...@googlegroups.comFor more options, visit this group at http://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
HABTM Saving
For my problem, a User HABTM Profiles A user can select multiple profiles via a screen. I get these values in my controller. I want to link all these profiles with the user. Currently i'm doing: $profile_1['Profile']['id'] = 1234; //the profile id $profile_1['User']['id'] = 1010; // The user id $this-User-save($profile_1); $profile_2['Profile']['id'] = 5678; //the profile id $profile_2['User']['id'] = 1010; // The user id same as before $this-User-save($profile_2); However, this creates only the 2nd link in the HABTM table. Is there a way that I can create both the links (1010-1234 and 1010-5678) in a single shot? Thanks! Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Best practice query - Where to render element
@Nabil, @Sam, thanks both for your ideas! I believe for consistency sake thruout the app, i'll stick to the controller-view-element chain (comin from a J2EE backgrnd, its hard to break conventions and rules :) ) But of course as you guys suggested, i can excuse myself in certain cases. KS On Jul 15, 12:26 am, Sam s...@masterscommission360.com wrote: One use I've had for rendering an element in the controller(well, from a component actually) is for a form plugin- my users could put a bbcode like tag in the body of a page and it would render the proper form within their content... normally I would do this processing with a helper, but the form fields were stored in the database, which made a component a more logical place to retrieve the data and render the element. On Jul 14, 1:17 pm, Nabil Alsharif bli...@gmail.com wrote: It's usually best to have the view render the elements and to pass settings/variables to view that passes it on to the element but to every rule there are exceptions. On Wed, Jul 14, 2010 at 1:52 PM, sanedevil sanede...@gmail.com wrote: Hi Bakers! Is it ok to render an element from a controller? Or as a best practice, let the controller always render the view and then in the view render the element? Thanks! KS Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php?hl=en Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Best practice query - Where to render element
Hi Bakers! Is it ok to render an element from a controller? Or as a best practice, let the controller always render the view and then in the view render the element? Thanks! KS Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: Hello World JS Helper example
Cricket, Fredflint, Thanks for the info. Really helps. as things turn out, i got the example running myself :) but the article that Fred mentioned is really valuable! thanks again! On Jul 12, 11:00 pm, fredfl...@gmail.com fredfl...@gmail.com wrote: I found this article about CakePHP and AJAX via google:http://www.reversefolds.com/articles/show/ajax I was able to get this running locally following the instructions on the blog. On Jul 12, 2:42 pm, sanedevil sanede...@gmail.com wrote: Hi all, I have started to experiment with JS Helper and was very hopeful that the Cake framework will help me avoid a lot of javascript learning via its API. so far i have been struggling (spent the entire weekend! ) gettin a simple hello world example to run :( Can someone pls share a simple example? I'd appreciate if it has things like . Which js library to use and how to include it in my View? . The series of steps needed to get the example running.. million thanks in adv! KS Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Hello World JS Helper example
Hi all, I have started to experiment with JS Helper and was very hopeful that the Cake framework will help me avoid a lot of javascript learning via its API. so far i have been struggling (spent the entire weekend! ) gettin a simple hello world example to run :( Can someone pls share a simple example? I'd appreciate if it has things like . Which js library to use and how to include it in my View? . The series of steps needed to get the example running.. million thanks in adv! KS Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en