Re: Validate UK postcode without a space in it
Thanks for the custom rule, I've used it and it seems to work well. Thanks again. c5 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Validate UK postcode without a space in it
Hi I've got a model that uses 'rule'=>array('postal',null,'uk') to successfully validate UK postcodes. However testing has shown that many people enter their postcodes in forms without using the space, so: W1W 5QU <-- validates W1W5QU <-- does not validate Has anyone got any tips on getting the validation to work irrespective of whether a user includes or excludes the space? Thanks c5 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Joining two arrays to use in a Select box with the formhelper
Hi I have a select box that is populated by a database: $isps = $this->Consultation->Isp->find('list'); and then output using the form helper in the view: echo $form->select('isp_id', $isps, array('selected' => $ispselect), array(), 'select your supplier'); This works fine, however what I want to do is have an extra option inserted between the empty element 'select your supplier' and the first item from the array $isp , this option would allow me to have the option selected be "none of the below". I can't for the life of me figure out how to do this, can anyone give me any pointers? Thanks very much c5 --~--~-~--~~~---~--~~ 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: Joining two arrays to use in a Select box with the formhelper
Thanks all for your help, worked a charm! Thanks again :) c5 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Contains and conditions gives rather unexpected results
Hi All I am working through examples of containable and applying conditions to the results. I have a basic blog example running, where Posts can have many comments. I'm trying to use contain with conditions so I can pick out only posts that have been commented on by a particular user. Here is my test function from my controller: function test() { $result = $this->Post->find('all',array('contain' => 'Comment.name = "Howard"')); debug($result); } I would expect the debug output in my view to only contain Posts which user Howard has commented on.. however here are the results I get: Array ( [0] => Array ( [Post] => Array ( [id] => 1 [name] => First post [date] => 2009-08-13 15:01:00 [content] => This is our first blog post, how exciting. [user_id] => 1 ) [Comment] => Array ( [0] => Array ( [id] => 1 [name] => Howard [content] => Lovely post, really lovely post. [post_id] => 1 ) ) ) [1] => Array ( [Post] => Array ( [id] => 2 [name] => Our second post [date] => 2009-08-14 10:11:00 [content] => Our second post [user_id] => 1 ) [Comment] => Array ( ) ) So as you can see it is still returning ALL posts yet only attaching comments if they were made by Howard. This isn't the behaviour I was expecting, as the example code shown at http://book.cakephp.org/view/474/Containable claims it should exclude all Posts without comments by the specified user. I am hoping someone can point me in the right direction here. Thanks c5 --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---