Re: Internationalization in Cakephp help( for a newbie)
Hi Marcelo, Thanks for ur reply. Can I get a sample code for internationalization? I cant find it in google... Thanks, Jayanand Bhushi 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: Problem with AJAX submission
Have you added the javascript libraries? - prototype - scriptaculous Enjoy, John On Dec 9, 9:03 pm, thomaus wrote: > Hi John, > > Thanks for helping. > > I actually made a mistake when pasting the code. The original trial > was > > submit(__('send', true), array('url'=> array > ('controller'=>'users', 'action'=> 'recoverPassword'), 'class'=> > 'button', 'update' => 'messages')); ?> > > and the same happens, basically nothing nothing at all when I click on > the Send button. > > Don't know if it helps but here is the corresponding generated HTML > code : > > value="Send" id="submit116667344" onclick="event.returnValue = false; > return false;" /> > // Event.observe("submit116667344", 'click', function(event) { new > Ajax.Updater('messages','/MyApp/html/users/recoverPassword', > {asynchronous:true, evalScripts:true, parameters:Form.serialize > (Event.element(event).form), requestHeaders:['X-Update', > 'messages']}) }, false); > //]]> > > > > > Thanks, > > On Dec 9, 6:42 pm, John Andersen wrote: > > > I do observe that your ajax->submit is supposed to call your "login" > > action in your "users" controller and not your "recoverPassword" > > action! > > Please check your code or your statement :) > > Enjoy, > > John > > > On Dec 9, 3:03 pm, thomaus wrote: > > > > Hi there, > > > > I just built an AJAX form and it doesn't work at all! > > > > My code: > > > > > > > Recover lost password > > > Enter your e-mail address and we will send a reset link to your > > > email > > > create('User'); ?> > > > input('email', array('label' => > > > __('Your > > > Email', true), 'class' => 'text-input')); ?> > > > > > > > submit(__('Send', true), > > > > > > array('url'=> array('controller'=>'users', 'action'=> > > > 'login'), > > > > > > 'class'=> 'button', > > > > > > 'update' => 'messages')); ?> > > > > end(); ?> > > > > > > > The button appears and when I click on it, absolutely nothing happens > > > while if I type myapp/users/recoverPassword in my browser it of course > > > calls my controller correctly. > > > > Thanks in advance, > > > > thomas... > > 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: Changes in CakePHP and new plugins
Number [2] should be http://cakephp.lighthouseapp.com/projects/42649-cakephp-2x/overview 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
Changes in CakePHP and new plugins
With the development of 1.3 and 2.0 well underway the CakePHP team has taken some time to re-evaluate and reconsider some of the tools we use as a team and as a community. Recently, CakePHP has undergone several changes, such as switching from Subversion to Git, and switching from trac to the current code.cakephp.org issue tracker. Each of these changes has brought change helping the community and project grow. We feel at this time that the change to code.cakephp.org (using thechaw.com software) has not been an entirely beneficial change. The code.cakephp.org code base has a number of issues, and the present core team lacks the interest to improve this code as there are numerous existing solutions that fit our needs. After hours of discussion and considering many different options and avenues, we've decided that the best course of action is to utilise one of the many existing open source supporting project management web applications. We will be using github[1] for source control. In addition we will be using lighthouse[2][3] for issue tracking and temporary documentation in the form of wiki pages. As before there are separate repositories for CakePHP1.x[4] and CakePHP2.x[5], as well as separate lighthouse projects. We feel these changes will provide the community with the tools and resources they need and have requested. In addition these changes will lighten the load on the core team allowing us to focus on we do best, create the best framework and related tools we can. We hope you - the community - can understand our motivations for wanting to switch and sincerely apologize for any inconvenience it will cause you. Once the transition is complete trac and code.cakephp.org will be deactivated and all activity related to CakePHP will occur on github and lighthouse. We expect this transition to take no more than a couple of days. The repository on github has had some of the history rewritten to fix irregularities and errors that occurred in the past. If you have local changes in your clones you should be able to migrate and maintain those changes by rebasing your changes. At this time we'd also like to announce the introduction of two new projects, named localized[6] and datasources[7]. Localized is a project designed to contain all the country specific validators for 1.3. At the time of writing we have 13 countries already partially or fully implemented. If your country is not in the repository please fork the project, add your country and send a pull request. Datasources is a project to contain community powered datasource classes. Initially this repository will contain the datasources that have been deprecated and removed from 1.3. Over time we hope it grows into a useful repository for datasources of all shapes and sizes. By keeping these two projects separate from CakePHP we can provide a more flexible release schedule that does not conform to that of CakePHP itself. Both datasources and localized have lighthouse projects for issue tracking so please file any issues with these plugins on their respective lighthouses[8][9]. If you are interested in getting involved with either project, please fork the project on github and send any pull requests. [1] http://github.com/cakephp [2] http://cakephp.lighthouseapp.com/projects/42648-cakephp-1x/overview [3] http://cakephp.lighthouseapp.com/projects/42648-cakephp-1x/overview [4] http://github.com/cakephp/cakephp1x [5] http://github.com/cakephp/cakephp2x [6] http://github.com/cakephp/localized [7] http://github.com/cakephp/datasources [8] http://cakephp.lighthouseapp.com/projects/42658-localized/ [9] http://cakephp.lighthouseapp.com/projects/42657-datasources 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: Email with unwanted white spaces and special characters
How do you send email? I don't have such problems with $this->Email- >send() call (no params). On Dec 6, 7:57 pm, Mauro Ribeiro wrote: > All I have in my template is the html/default.ctp: > > > > > > > > > The message is being written in controller and sent by CakePHP Email > Component. > > Even if I use the default text (text/default.ctp), I get the same > issue... > > No idea on what what`s going on. > > On 5 dez, 18:52, mike karthauser wrote: > > > > > Perhaps you could post the php inside your template so we could see > > it? Also are you sanitizing your email addresses as perhaps there is > > extra characters being captured that you are giving to your view? > > > Mike Karthauser > > Brightstorm limited > > Tel: 07939252144 > > > On 5 Dec 2009, at 12:22, Mauro Ribeiro wrote: > > > > Hi all! > > > > I`m using the CakePHP Email Component and the resulting email appear > > > with some not wanted whitespaces and special characters along the > > > HTML. > > > > Sometimes this happens inside tags and break the href > > > property. > > > > Here is an example: > > > > - > > > > http://www.empreendemia.com.br/users/ > > > create/ > > > user.em...@gmail.com+/X" target="_blank">http:// > > >www.empreendemia.com.br/users/create/user.em a...@gmail.com /X > > a> > > > > - > > > > It appeared a "+" in href link and some whitespaces inside text > > > > Does someone now what`s happening? > > > > Thanks in advance, > > > Mauro > > > > 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
Re: Running the action twice?
requestAction somewhere? In a view, or beforeRender, or afterFilter maybe? On Dec 10, 5:05 am, bujanga wrote: > I have looked over this code many times and really just don't know why > this is happening. It seems that cake is performing the action twice. > How do I know this? I am receiving 2 of each email. If I put an exit > statement before the end of the action, I only receive 1 of each > email. > > As a background, I am using Security->requireSecure() in my > beforeFilter along with the blackHoleCallback = 'forceSSL' callback > shown in the book.http://book.cakephp.org/view/268/Usage > > Here is my action: > -- > function pmt_receipt($tid=NULL, $pid=NULL, $cid=NULL){ > if ( isset($this->params['named']['tid']) ){ > $tid = $this->params['named']['tid']; > $pid = $this->params['named']['pid']; > $cid = $this->params['named']['cid']; > } > if ( is_null($tid) || is_null($pid) || is_null($cid) ) > $this->redirect(array('action'=>'pmt_error', 0008)); > > $purchase_formatted = > $this->PurchaseModel->ggis_format_purchase($pid); > $purchase_formatted .= > $this->CcPaymentechChpp->ggis_format_payment($cid); > // NOTIFY BY EMAIL > $this->Transaction->emailnotify($tid); > // SUBSCRIBE TO EMAIL LIST > $this->Transaction->newslettersubscribe($tid); > // REMOVE DATA FROM THE SESSION > $this->Session->delete('purchase'); > > $purchase_msg = 'Your credit card has been successfully > processed. Please print a copy of this page as your receipt.'; > $purchase_msg .= 'Shortly you will receive an email, reiterating > the information on this page.'; > $this->CreditCard = ClassRegistry::init('CreditCard'); > $this->set('formOptions', $this->CreditCard->get_formOptions()); > $this->set('purchase_msg', $purchase_msg); > $this->set('purchase_formatted', $purchase_formatted);} > > -- > > The emailnotify and newslettersubscribe methods have been working > without issue for other controllers for quite some time. > > Any help would be greatly appreciated. Thank you. > > Gary Dalton 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: Undefined variable: url [APP/webroot/index.php ?
In the migration guide it said TO UPDATE this file. All you need to do is remove the $url variable from dispatch(). On Dec 9, 3:30 pm, "d'plus" wrote: > I got error: > > Notice (8): Undefined variable: url [APP/webroot/index.php, line 82] > Code | Context > > } else { > $Dispatcher = new Dispatcher(); > $Dispatcher->dispatch($url); > > $GLOBALS = array( > "GLOBALS" => array( > "GLOBALS" => array(), > "_ENV" => array(), > > I recently upgraded from 1.1.8 to 1.3 alpha. > I didn't modified the index.php file - it is original from alpha > package. 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
Undefined variable: url [APP/webroot/index.php ?
I got error: Notice (8): Undefined variable: url [APP/webroot/index.php, line 82] Code | Context } else { $Dispatcher = new Dispatcher(); $Dispatcher->dispatch($url); $GLOBALS= array( "GLOBALS" => array( "GLOBALS" => array(), "_ENV" => array(), I recently upgraded from 1.1.8 to 1.3 alpha. I didn't modified the index.php file - it is original from alpha package. 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
Running the action twice?
I have looked over this code many times and really just don't know why this is happening. It seems that cake is performing the action twice. How do I know this? I am receiving 2 of each email. If I put an exit statement before the end of the action, I only receive 1 of each email. As a background, I am using Security->requireSecure() in my beforeFilter along with the blackHoleCallback = 'forceSSL' callback shown in the book. http://book.cakephp.org/view/268/Usage Here is my action: -- function pmt_receipt($tid=NULL, $pid=NULL, $cid=NULL){ if ( isset($this->params['named']['tid']) ){ $tid = $this->params['named']['tid']; $pid = $this->params['named']['pid']; $cid = $this->params['named']['cid']; } if ( is_null($tid) || is_null($pid) || is_null($cid) ) $this->redirect(array('action'=>'pmt_error', 0008)); $purchase_formatted = $this->PurchaseModel->ggis_format_purchase($pid); $purchase_formatted .= $this->CcPaymentechChpp->ggis_format_payment($cid); // NOTIFY BY EMAIL $this->Transaction->emailnotify($tid); // SUBSCRIBE TO EMAIL LIST $this->Transaction->newslettersubscribe($tid); // REMOVE DATA FROM THE SESSION $this->Session->delete('purchase'); $purchase_msg = 'Your credit card has been successfully processed. Please print a copy of this page as your receipt.'; $purchase_msg .= 'Shortly you will receive an email, reiterating the information on this page.'; $this->CreditCard = ClassRegistry::init('CreditCard'); $this->set('formOptions', $this->CreditCard->get_formOptions()); $this->set('purchase_msg', $purchase_msg); $this->set('purchase_formatted', $purchase_formatted); } -- The emailnotify and newslettersubscribe methods have been working without issue for other controllers for quite some time. Any help would be greatly appreciated. Thank you. Gary Dalton 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: How to validate HABTM model with extra fields?
actually its usually the other way around it may validate more fields, but can save only the foreign keys (not even created/modified automagic timestamps!) On 9 Dez., 15:08, red wrote: > Yes, probably I'll do as you propose (split to 2x hasMany and 2x > belongsTo), but I suggested that is possible to validate HABTM data, > because saveAll() handles perfect with additional data in join table. > > So why I can easly save data, but can't validate? What about 'with' > parameter in hasAndBelongsToMany relation? > > On Dec 9, 2:45 pm, euromark wrote: > > > cake HABTM does only work with 3 fields > > id > > foreign_id1 > > foreign_id2 > > > nothing more or less > > > if you need to add created, modified, amount, ... > > you will have to split it into 2 "hasMany" + 2 "belongsTo" relations > > > this is always possible - but maybe not as easy to handle anymore > > it has some advantages, though, too: it doesnt delete and insert all > > records after each save() > > > the cake habtm might be ok for some relations, but > > i usually always use those split tables as they are way more powerful! > > > On 9 Dez., 14:28, red wrote: > > > > Hello, I've already asked on cakeqs.org but I'll try also here. > > > > My case is: Order HABTM Product. In joining table orders_products I've > > > extra field - quantity. Now, when editing Order I can add Products and > > > enter quantitiy. Here is what I've done already: > > > > In model Order: > > > public $hasAndBelongsToMany = array( > > > 'Product' => array( > > > 'className' => 'Product', > > > 'joinTable' => 'orders_products', > > > 'foreignKey' => 'order_id', > > > 'associationForeignKey' => 'product_id', > > > 'unique' => true, > > > 'with' => 'OrdersProduct' > > > ) > > > ); > > > > In model Product: > > > public $hasAndBelongsToMany = array( > > > 'Order' => array( > > > 'className' => 'Order', > > > 'joinTable' => 'orders_products', > > > 'foreignKey' => 'product_id', > > > 'associationForeignKey' => 'order_id', > > > 'unique' => true, > > > 'with' => 'OrdersProduct' > > > ) > > > ); > > > > I've created model for joining table OrdersProduct: > > > class OrdersProduct extends AppModel { > > > public $name = 'OrdersProduct'; > > > > public $validate = array( > > > 'quantity' => array( > > > 'numeric' => array('rule' => array('notempty')) > > > ) > > > ); > > > > } > > > > In orders editing view I've: > > > Form->input("Product.0.OrdersProduct.product_id", > > > array('label' => false, 'options' => $products)); ?> > > > Form->input("Product.0.OrdersProduct.quantity", array > > > ('label' => false, 'class' => 'text')); ?> > > > > Now in Orders controller try to save: > > > // Form processing > > > if (!empty($this->data)) { > > > $this->Order->OrdersProduct->set($this->data); > > > debug($this->Order->OrdersProduct->validates()); > > > > if ($this->Order->saveAll($this->data)) { > > > // Do some stuff > > > } > > > } > > > > And $this->Order->OrdersProduct->validates() always returns TRUE, no > > > matter if I enter quantity or not. All the data saves perfect, only no > > > validation is problem. What I'm missing? 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: Create .ctp file
http://www.google.com/search?q=create+views+cakephp On Wed, Dec 9, 2009 at 5:19 PM, 00Cake wrote: > Hi All, > > I am starting discovering CakePHP and have try to do the blog tutorial > > Here is a trivial question: > > How to create a view ? How to create a .ctp file ?? > > I have not find nothing about that!! > > Thanks > > Oliver > > 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.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- http://phpirate.net 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
Create .ctp file
Hi All, I am starting discovering CakePHP and have try to do the blog tutorial Here is a trivial question: How to create a view ? How to create a .ctp file ?? I have not find nothing about that!! Thanks Oliver 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: Is Cake Certification still offered?
+1 On Wed, Dec 9, 2009 at 4:24 PM, Marcelo Andrade wrote: > On Sun, Dec 6, 2009 at 8:55 AM, hash wrote: > > Hi guys, I want to know whether Cake Certification is still being > > offered because I want to apply as a Cake Certified Engineer. I > > emailed Cake Foundation but got no reply. > > On Sun, Dec 6, 2009 at 5:39 PM, Jon Bennett wrote: > >> Ive never even heard of a cake certification, care to tell? Or sources > >> of where you heard about it? > > > > http://cakefoundation.org/pages/certification > > Very interesting! I'd like to know more about too. > > -- > MARCELO DE F. ANDRADE > Belem, PA, Amazonia, Brazil > Linux User #221105 > > 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.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > -- http://phpirate.net 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: shared host setup
Hi, > worked it out. > > heres the code i added > > Debugger::dump($component); > Debugger::dump($object); > Debugger::dump($parent); So is your project working now? Regards, Piotr 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: Is Cake Certification still offered?
On Sun, Dec 6, 2009 at 8:55 AM, hash wrote: > Hi guys, I want to know whether Cake Certification is still being > offered because I want to apply as a Cake Certified Engineer. I > emailed Cake Foundation but got no reply. On Sun, Dec 6, 2009 at 5:39 PM, Jon Bennett wrote: >> Ive never even heard of a cake certification, care to tell? Or sources >> of where you heard about it? > > http://cakefoundation.org/pages/certification Very interesting! I'd like to know more about too. -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 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: MAC + CakePHP
Wils, Try to add: AllowOverride All inside the apache virtualhost config Andras Kende On Dec 9, 2009, at 1:37 PM, Wils wrote: > Hi Guys, > > I'm trying to do some test with my cakephp setup. > > My folder structure: > bash-3.2$ pwd > /Users/wils/projects/ibanx > > bash-3.2$ ls -alh > total 16 > drwxr-xr-x 7 wils staff 238B 8 Dec 21:39 . > drwxr-xr-x 7 wils staff 238B 8 Dec 20:22 .. > -rw-r--r--@ 1 wils staff 1.1K 9 Sep 00:21 README > drwxr-xr-x@ 14 wils staff 476B 9 Sep 00:21 app > drwxr-xr-x@ 11 wils staff 374B 9 Sep 00:21 cake > -rw-r--r--@ 1 wils staff 2.2K 9 Sep 00:21 index.php > drwxr-xr-x@ 6 wils staff 204B 9 Sep 00:23 vendors > bash-3.2$ > > My VirtualHost: > >ServerAdmin webmas...@dummy-host2.example.com >DocumentRoot "/Users/wils/projects/ibanx" ># > >Options Indexes FollowSymLinks >Allow from All AllowOverride All > >ServerName ibanx.com >ErrorLog "/private/var/log/apache2/wils.com-error_log" >CustomLog "/private/var/log/apache2/wils.com-access_log" common > > > > The problem: > I can see the cakephp start page however without css/images. > > Anybody has found this error before? > How did you fix? > > tks > Wils > > 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 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: Problem with AJAX submission
Hi John, Thanks for helping. I actually made a mistake when pasting the code. The original trial was submit(__('send', true), array('url'=> array ('controller'=>'users', 'action'=> 'recoverPassword'), 'class'=> 'button', 'update' => 'messages')); ?> and the same happens, basically nothing nothing at all when I click on the Send button. Don't know if it helps but here is the corresponding generated HTML code : // Thanks, On Dec 9, 6:42 pm, John Andersen wrote: > I do observe that your ajax->submit is supposed to call your "login" > action in your "users" controller and not your "recoverPassword" > action! > Please check your code or your statement :) > Enjoy, > John > > On Dec 9, 3:03 pm, thomaus wrote: > > > Hi there, > > > I just built an AJAX form and it doesn't work at all! > > > My code: > > > > > Recover lost password > > Enter your e-mail address and we will send a reset link to your > > email > > create('User'); ?> > > input('email', array('label' => > > __('Your > > Email', true), 'class' => 'text-input')); ?> > > > > > submit(__('Send', true), > > > > array('url'=> array('controller'=>'users', 'action'=> > > 'login'), > > > > 'class'=> 'button', > > > > 'update' => 'messages')); ?> > > > end(); ?> > > > > > The button appears and when I click on it, absolutely nothing happens > > while if I type myapp/users/recoverPassword in my browser it of course > > calls my controller correctly. > > > Thanks in advance, > > > thomas... 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
MAC + CakePHP
Hi Guys, I'm trying to do some test with my cakephp setup. My folder structure: bash-3.2$ pwd /Users/wils/projects/ibanx bash-3.2$ ls -alh total 16 drwxr-xr-x 7 wils staff 238B 8 Dec 21:39 . drwxr-xr-x 7 wils staff 238B 8 Dec 20:22 .. -rw-r--r--@ 1 wils staff 1.1K 9 Sep 00:21 README drwxr-xr-x@ 14 wils staff 476B 9 Sep 00:21 app drwxr-xr-x@ 11 wils staff 374B 9 Sep 00:21 cake -rw-r--r--@ 1 wils staff 2.2K 9 Sep 00:21 index.php drwxr-xr-x@ 6 wils staff 204B 9 Sep 00:23 vendors bash-3.2$ My VirtualHost: ServerAdmin webmas...@dummy-host2.example.com DocumentRoot "/Users/wils/projects/ibanx" # Options Indexes FollowSymLinks Allow from All ServerName ibanx.com ErrorLog "/private/var/log/apache2/wils.com-error_log" CustomLog "/private/var/log/apache2/wils.com-access_log" common The problem: I can see the cakephp start page however without css/images. Anybody has found this error before? How did you fix? tks Wils 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: Paginator helper in Cake 1.3
When I wrote the tutorial my paging element was in the view, under the table. I also had a writeBuffer() call *after* the paging element. If you are using mootools or prototype, you need to set the evalScripts option to true. I can try to write a more complete tutorial, as part of the documentation, but I don't know what is really lacking from the current one. -Mark On Dec 8, 3:33 pm, chango wrote: > I've had also tried to follow the instructions at Mark's blog. I have > succeded midly in doing it with jquery. But there are a few issues > that I've been facing. > > 1. The success callback is not called when using jquery. (using > complete instead) > 2. Where should I put the paging element?, outside the updated element > or inside the updated element?. > If I put the pager outside everything works well except that the pager > doesn't get updated > If I put the pager inside the updated element with a new $js- > > >writeBuffer() after everything the generated JS isn't executed. > > Is there a correct way to do this? > > On Oct 25, 3:35 pm, jacmoe wrote: > > > > > Check Marks > > blog:http://mark-story.com/posts/view/creating-simple-ajax-pagination-with... > > > I tried it, but no luck yet. > > CakePhp1.3seems to be more picky about this than 1.2. > > Will bake a fresh app and make it work, and then try and backtrack my > > own project.. :) > > > On Oct 25, 5:15 pm, dijichi wrote: > > > > I have exactly the same problem, with mootools. Anyone got this > > > working? > > > > On Oct 22, 10:13 pm, jacmoe wrote: > > > > > I tried Mootools, jQuery and Prototype - no luck. :) > > > > Prototype and Mootools seems to be ignored by Cake.. > > > > 'Js' => array('Prototype') or 'Js' => array('Mootools') > > > > I only get regular, non-Ajaxedpagination. > > > > However, when choosing jQuery, the links stops working. > > > > By that I mean: they are dead. Nothing, not even regularpagination, > > > > happens. > > > > > This is my link lines: > > > > echo $this->Html->script(array('prototype', 'scriptaculous')); > > > > echo $this->Html->script(array('mootools-1.2.4-core-jm', > > > > 'mootools-1.2.4.1-more')); > > > > echo $this->Html->script(array('http://ajax.googleapis.com/ajax/libs/ > > > > jquery/1.3.2/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/ > > > > jqueryui/1.7.2/jquery-ui.min.js')); > > > > > I am not loading them at the same time. And I load them in my main > > > > layout, in head, just before > > > > > By the way, here's my paginator options: > > > > > options(array('update' => 'listing', 'indicator' => > > > > 'spinner', 'url' => $this->passedArgs)); ?> > > > > > And here's my paginator links: > > > > > prev('<< '.__('previous', true), > > > > array(), > > > > null, array('class'=>'disabled'));?> > > > > | numbers();?> > > > > next(__('next', true).' >>', > > > > array(), null, > > > > array('class'=>'disabled'));?> > > > > > I will make a minimal app, and see if I can get it to work there.. > > > > > I am doomed. :P 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: download API documentation and book
Well yes you will get missing table errors if you skip installation steps. You haven't created the tables the plugin uses. You need to run `cake api_index initdb` as detailed in the installation instructions. The plugin does not contain the specific cakephp theme, as that's not really the scope of the project, but it should be sufficient to generate and view api docs. There are currently no plans to make a downloadable version of the API, as the generator is reasonable easy to setup if you follow all the steps. I guess you could use a site scraper to collect all the various pages and create local copies as well. -Mark On Dec 8, 4:16 pm, Lorenzo Bettini wrote: > OK, I had to register and now I downloaded the sources, but it's quite > hard to have something generated, and the URL is generic and not for the > API of cakephp itself... > > I keep getting this error, when updating: > > Clearing index and regenerating class index... > Error: Missing database table 'api_classes' for model 'ApiClass' > > I really think a downloadable version of the APIs should be made > available for offline browsing, since generating them is not that > straightforward... ;) > > thanks > Lorenzo > > > > > > mark_story wrote: > > Just so happens there is a wiki page for this very subject. > > >http://thechaw.com/api_generator/wiki/home/docs/installation/Installa... > > > -Mark > > > On Dec 8, 5:53 am, Lorenzo Bettini wrote: > >> any suggestion on the command line to run, in order to generate the API > >> of cakephp? > > >> thanks in advance > >> Lorenzo > > >> mark_story wrote: > >>> The api is generated by the ApiGenerator plugin found at (http:// > >>> thechaw.com/api_generator). You can download it and generate your own > >>> api. > >>> -Mark > >>> On Dec 3, 5:42 am, Lorenzo Bettini wrote: > Hi > is there a version of APIs and book documentation to be downloaded for > offline browsing? > > -- > Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino > HOME:http://www.lorenzobettini.itMUSIC:http://www.purplesucker.com > BLOGS:http://tronprog.blogspot.com http://longlivemusic.blogspot.com 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: Poll component
A poll system is a database. You cant use a component nor a helper for this. I even doubt you can create a behavior for it. All you have to do is create the tables and models and build the associations. On Dec 9, 8:16 am, Ziki wrote: > I know, but i don't have time to write it. Newer mind. tnx > > On 9 pro, 13:16, euromark wrote: > > > its not that hard to write one on your own > > > you need > > - polls > > - poll_votes > > - poll_options > > > but i would not do it as a component but as a controller/model (with > > its own admin panel etc) > > and just provide some basic elements for other views > > > On 9 Dez., 04:11, Ziki wrote: > > > > Hi, is there any poll component or some php Poll code which is CakePHP > > > friendly? 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: Problem with AJAX submission
I do observe that your ajax->submit is supposed to call your "login" action in your "users" controller and not your "recoverPassword" action! Please check your code or your statement :) Enjoy, John On Dec 9, 3:03 pm, thomaus wrote: > Hi there, > > I just built an AJAX form and it doesn't work at all! > > My code: > > > Recover lost password > Enter your e-mail address and we will send a reset link to your > email > create('User'); ?> > input('email', array('label' => > __('Your > Email', true), 'class' => 'text-input')); ?> > > > submit(__('Send', true), > > array('url'=> array('controller'=>'users', 'action'=> > 'login'), > > 'class'=> 'button', > > 'update' => 'messages')); ?> > > end(); ?> > > > The button appears and when I click on it, absolutely nothing happens > while if I type myapp/users/recoverPassword in my browser it of course > calls my controller correctly. > > Thanks in advance, > > thomas... 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: Poll component
I know, but i don't have time to write it. Newer mind. tnx On 9 pro, 13:16, euromark wrote: > its not that hard to write one on your own > > you need > - polls > - poll_votes > - poll_options > > but i would not do it as a component but as a controller/model (with > its own admin panel etc) > and just provide some basic elements for other views > > On 9 Dez., 04:11, Ziki wrote: > > > Hi, is there any poll component or some php Poll code which is CakePHP > > friendly? 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: Permission denied page instead of login page
Jeremy, Thanks for the reply but that doesn't really work right. It does then redirect everything to a access denied page, but it also causes all login attempts to redirect to that page as well. Even when I try to access /admin/users/login I get redirected to the access denied page. Anyone else have a suggestion? -Jesse On Dec 7, 9:20 am, Jeremy Burns wrote: > I don't for a minute think I have the answer but would hate you to > feel too lonely! This is just a wild suggestion and I apologise if > it's totally wrong. Have you thought about changing your > $this->Auth->loginAction to point to your "Permission denied" page? Then if > > someone does something that needs a login, they'll be directed there. > Then you can have your true login links pointing to the login page. > Would that work? > > On Dec 7, 3:08 pm, Jesse wrote: > > > > > Anyone have an idea for this? I really need to get this feature > > implemented. > > > -Jesse > > > On Dec 3, 2:04 pm, Jesse wrote: > > > > I have a pretty complex site setup with an administration section that > > > uses the Auth Component. > > > > What I'm wondering is if it is possible to show a "Page Denied" page > > > instead of the Login page when a user tries to access a restricted > > > page. > > > > I have my authorization set up by component. At the top of each > > > controller I have a beforeFilter function, and a $this->Auth->allow > > > for those actions that are available. > > > > We have been tightening up the site and I'm sure this will cause some > > > bad links and I don't really want it to be any easier to find the > > > login screen for out website. As the site works now if someone tries > > > to access an action that's protected it redirects them to a "Login" > > > screen (I'm sure this is pretty standard for how most CakePHP sites > > > are set up). > > > > Is there a way that I can have these redirected to a "access deneid" > > > page (/pages/access_denied) page instead of the login screen? I only > > > want the login screen to be displayed is someone types > > > inhttp://homepage.com/admin > > > > Here is my Auth stuff in the app_controller.php setup: > > > > $this->Auth->loginAction = '/admin/users/login'; > > > $this->Auth->loginRedirect = '/admin/users/login'; > > > $this->Auth->logoutRedirect = '/'; > > > $this->Auth->allow('display', ); > > > $this->Auth->authorize = 'controller'; > > > > if (isset($this->params['admin'])) { > > > $this->layout = 'admin_default'; > > > > } > > > > function isAuthorized(){ > > > return true; > > > > } 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: 404 Not Found Error
Yeah it was a redirect at the end that I over looked. Working fine after I removed it. Thanks, Dave -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of r4zv4n Sent: December-09-09 5:31 AM To: CakePHP Subject: Re: 404 Not Found Error And as an alternative place to check, what's the action for your form (did you start the form with $form->create('User'); ?) On Dec 8, 2:55 pm, Dave wrote: > What is the code for your redirect at the end of your add method > > > > > > On Mon, Dec 7, 2009 at 11:20 PM, Dave wrote: > > Any idea why this would happen? > > site/admin/users/add when i go to that page it works fine. Add a new > > user which goes to site/admin/users/add and I get 404 Error. > > > The page is obviously there and accessible since im on the page > > adding a user but when i post the data it comes back 404. > > > Any ideas why this might happen? > > > Dave > > > 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 > cake-php+roups.com>For 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 cake-php+at http://groups.google.com/group/cake-php?hl=en No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.709 / Virus Database: 270.14.96/2549 - Release Date: 12/08/09 04:04:00 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
dyamic dropdown list wtih dyanamic optgroup
Hi there cakephp experts! I am looking for you help on a dyanmic dropdown list with dyanamic optgroup. Suppose I have two tables: countries: id, country_name, counties: id, county_name, country_id Now, I want to display a dropdown list with optgroups populated frm countries table and list items populated from counties. country_name1 county_name1 county_name2 country_name2 county_name3 county_name4 country_name3 county_name4 county_name5 ... Thanks in advance and appreciate any help!! 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
XML Helper & Cake = Bugs!
Hi, I need to use XML and JSON outputs for an API that I program for a project that has a web backend and multiple mobile clients. The Javascript helper with Cake works just fine, but the XML Helper is full of bugs. I posted the initial problem here: http://groups.google.com/group/cake-php/browse_thread/thread/e63ebbe1c5c710a6/43a4b4da7d9b3bac?lnk=gst&q=xml#43a4b4da7d9b3bac and openend a ticket for it here: http://code.cakephp.org/tickets/view/79 But unfortunately haven't heard back so far. There are other issues with the XML Helper that should be resolved as reported here: http://groups.google.com/group/cake-php/browse_thread/thread/c66649159a9739b7/586b6bd6727ca874?lnk=gst&q=xml#586b6bd6727ca874 and here: http://groups.google.com/group/cake-php/browse_thread/thread/6f023e991cc2f038/d9b809e3d0a4bba3?lnk=gst&q=xml#d9b809e3d0a4bba3 Overall I have to conclude that the Cake XML helper currently unfortunately cannot be used to produce valid XML! This is a major flaw of the CakePHP framework and given the fact that there are a lot of different (working) XML parsers for PHP out there nothing that should be difficult to resolve. I'm currently thinking about switching to a different parser myself, because these issues have been here for a while and still no news. Don't get me wrong - I think CakePHP is great and love to use it, but XML is THE standard data interchange format and I think Cake shouldn't lower it's guard by not supporting it fully and correctly. Best, Tobias 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: How to validate HABTM model with extra fields?
Yes, probably I'll do as you propose (split to 2x hasMany and 2x belongsTo), but I suggested that is possible to validate HABTM data, because saveAll() handles perfect with additional data in join table. So why I can easly save data, but can't validate? What about 'with' parameter in hasAndBelongsToMany relation? On Dec 9, 2:45 pm, euromark wrote: > cake HABTM does only work with 3 fields > id > foreign_id1 > foreign_id2 > > nothing more or less > > if you need to add created, modified, amount, ... > you will have to split it into 2 "hasMany" + 2 "belongsTo" relations > > this is always possible - but maybe not as easy to handle anymore > it has some advantages, though, too: it doesnt delete and insert all > records after each save() > > the cake habtm might be ok for some relations, but > i usually always use those split tables as they are way more powerful! > > On 9 Dez., 14:28, red wrote: > > > > > Hello, I've already asked on cakeqs.org but I'll try also here. > > > My case is: Order HABTM Product. In joining table orders_products I've > > extra field - quantity. Now, when editing Order I can add Products and > > enter quantitiy. Here is what I've done already: > > > In model Order: > > public $hasAndBelongsToMany = array( > > 'Product' => array( > > 'className' => 'Product', > > 'joinTable' => 'orders_products', > > 'foreignKey' => 'order_id', > > 'associationForeignKey' => 'product_id', > > 'unique' => true, > > 'with' => 'OrdersProduct' > > ) > > ); > > > In model Product: > > public $hasAndBelongsToMany = array( > > 'Order' => array( > > 'className' => 'Order', > > 'joinTable' => 'orders_products', > > 'foreignKey' => 'product_id', > > 'associationForeignKey' => 'order_id', > > 'unique' => true, > > 'with' => 'OrdersProduct' > > ) > > ); > > > I've created model for joining table OrdersProduct: > > class OrdersProduct extends AppModel { > > public $name = 'OrdersProduct'; > > > public $validate = array( > > 'quantity' => array( > > 'numeric' => array('rule' => array('notempty')) > > ) > > ); > > > } > > > In orders editing view I've: > > Form->input("Product.0.OrdersProduct.product_id", > > array('label' => false, 'options' => $products)); ?> > > Form->input("Product.0.OrdersProduct.quantity", array > > ('label' => false, 'class' => 'text')); ?> > > > Now in Orders controller try to save: > > // Form processing > > if (!empty($this->data)) { > > $this->Order->OrdersProduct->set($this->data); > > debug($this->Order->OrdersProduct->validates()); > > > if ($this->Order->saveAll($this->data)) { > > // Do some stuff > > } > > } > > > And $this->Order->OrdersProduct->validates() always returns TRUE, no > > matter if I enter quantity or not. All the data saves perfect, only no > > validation is problem. What I'm missing? 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: How to validate HABTM model with extra fields?
cake HABTM does only work with 3 fields id foreign_id1 foreign_id2 nothing more or less if you need to add created, modified, amount, ... you will have to split it into 2 "hasMany" + 2 "belongsTo" relations this is always possible - but maybe not as easy to handle anymore it has some advantages, though, too: it doesnt delete and insert all records after each save() the cake habtm might be ok for some relations, but i usually always use those split tables as they are way more powerful! On 9 Dez., 14:28, red wrote: > Hello, I've already asked on cakeqs.org but I'll try also here. > > My case is: Order HABTM Product. In joining table orders_products I've > extra field - quantity. Now, when editing Order I can add Products and > enter quantitiy. Here is what I've done already: > > In model Order: > public $hasAndBelongsToMany = array( > 'Product' => array( > 'className' => 'Product', > 'joinTable' => 'orders_products', > 'foreignKey' => 'order_id', > 'associationForeignKey' => 'product_id', > 'unique' => true, > 'with' => 'OrdersProduct' > ) > ); > > In model Product: > public $hasAndBelongsToMany = array( > 'Order' => array( > 'className' => 'Order', > 'joinTable' => 'orders_products', > 'foreignKey' => 'product_id', > 'associationForeignKey' => 'order_id', > 'unique' => true, > 'with' => 'OrdersProduct' > ) > ); > > I've created model for joining table OrdersProduct: > class OrdersProduct extends AppModel { > public $name = 'OrdersProduct'; > > public $validate = array( > 'quantity' => array( > 'numeric' => array('rule' => array('notempty')) > ) > ); > > } > > In orders editing view I've: > Form->input("Product.0.OrdersProduct.product_id", > array('label' => false, 'options' => $products)); ?> > Form->input("Product.0.OrdersProduct.quantity", array > ('label' => false, 'class' => 'text')); ?> > > Now in Orders controller try to save: > // Form processing > if (!empty($this->data)) { > $this->Order->OrdersProduct->set($this->data); > debug($this->Order->OrdersProduct->validates()); > > if ($this->Order->saveAll($this->data)) { > // Do some stuff > } > } > > And $this->Order->OrdersProduct->validates() always returns TRUE, no > matter if I enter quantity or not. All the data saves perfect, only no > validation is problem. What I'm missing? 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
How to validate HABTM model with extra fields?
Hello, I've already asked on cakeqs.org but I'll try also here. My case is: Order HABTM Product. In joining table orders_products I've extra field - quantity. Now, when editing Order I can add Products and enter quantitiy. Here is what I've done already: In model Order: public $hasAndBelongsToMany = array( 'Product' => array( 'className' => 'Product', 'joinTable' => 'orders_products', 'foreignKey' => 'order_id', 'associationForeignKey' => 'product_id', 'unique' => true, 'with' => 'OrdersProduct' ) ); In model Product: public $hasAndBelongsToMany = array( 'Order' => array( 'className' => 'Order', 'joinTable' => 'orders_products', 'foreignKey' => 'product_id', 'associationForeignKey' => 'order_id', 'unique' => true, 'with' => 'OrdersProduct' ) ); I've created model for joining table OrdersProduct: class OrdersProduct extends AppModel { public $name = 'OrdersProduct'; public $validate = array( 'quantity' => array( 'numeric' => array('rule' => array('notempty')) ) ); } In orders editing view I've: Form->input("Product.0.OrdersProduct.product_id", array('label' => false, 'options' => $products)); ?> Form->input("Product.0.OrdersProduct.quantity", array ('label' => false, 'class' => 'text')); ?> Now in Orders controller try to save: // Form processing if (!empty($this->data)) { $this->Order->OrdersProduct->set($this->data); debug($this->Order->OrdersProduct->validates()); if ($this->Order->saveAll($this->data)) { // Do some stuff } } And $this->Order->OrdersProduct->validates() always returns TRUE, no matter if I enter quantity or not. All the data saves perfect, only no validation is problem. What I'm missing? 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
Problem with AJAX submission
Hi there, I just built an AJAX form and it doesn't work at all! My code: Recover lost password Enter your e-mail address and we will send a reset link to your email create('User'); ?> input('email', array('label' => __('Your Email', true), 'class' => 'text-input')); ?> submit(__('Send', true), array('url'=> array('controller'=>'users', 'action'=> 'login'), 'class'=> 'button', 'update' => 'messages')); ?> end(); ?> The button appears and when I click on it, absolutely nothing happens while if I type myapp/users/recoverPassword in my browser it of course calls my controller correctly. Thanks in advance, thomas... 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: Running cake using a cron job
Almost there... now have it running locally on the command line. For future reference, here's what I had to do: The cake executable is in cake/console, so I added D:/Work/MySiteName/ cake/console to my Windows path. >From the command line, typing 'cake' now gives a message about input variables etc. Now, if i go to D:/Work/MySiteName/ and type: cake -app /app, it takes app as my current working directory (from now on, I'll call this /app) Then I created a shell in app/vendors/shells and called it email.php In app/vendors/ I created the bash script that nurvzy gave in the post above, and saved it as email.sh Now if I go to /app and type cake email it works fine. So just need to upload it and get it working on the server now... Thanks for the help guys. On 8 Dec, 13:57, WhyNotSmile wrote: > Thanks for both of those - I'll try them out and see what happens. i > had already seen the CakePHP tutorial, but just couldn't quite get my > head around it. I think the problem was that it demonstrates running > scripts on Linux, and I couldn't get it to work on Windows. But I'll > try again and see how it goes. > > Thanks again for the replies. > > On Dec 8, 10:52 am, nurvzy wrote: > > > Indeed, however I dislike that tutorial on running shells as cronjobs. > > > Once you get yourself a nice shell to do what you want, getting it to > > run incronI've found its much easier to actually create a new little > > bash script that runs cake __whatever__ for you, then just executing > > your new bash script incron. > > > Example: > > Lets say you've written your shell task as do_something so you could > > run: "cake do_something" from the root of your application. To get > > that to run in a cronjob create a little worker bash called > > "do_something.sh" with the following: > > > #!/bin/bash > > clear > > cd /path/to/your/app/ > > /path/to/your/cake/libs/cake do_something > > > Then all you'd have to do in yourcronis this: > > 0 5 * * * /path/to/do_something.sh > > > Much more simple IMHO. > > > Hope that helps, > > Nick > > > On Dec 7, 10:56 am, Miles J wrote: > > > > Well your supposed to be using shells, not hitting a controller with a > > > cronjob. > > > >http://book.cakephp.org/view/846/Running-Shells-as-cronjobs 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: Poll component
its not that hard to write one on your own you need - polls - poll_votes - poll_options but i would not do it as a component but as a controller/model (with its own admin panel etc) and just provide some basic elements for other views On 9 Dez., 04:11, Ziki wrote: > Hi, is there any poll component or some php Poll code which is CakePHP > friendly? 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: apache setting for directory + alias
jep :) actually that was it thank you On 5 Dez., 05:48, "Dr. Loboto" wrote: > Add RewriteBase /app after RewriteEngine On > > On Dec 4, 5:59 am, euromark wrote: > > > Alias /app "/var/www/work/pages/app/webroot/" > > > > Options Indexes MultiViews FollowSymLinks > > > RewriteEngine On > > > RewriteCond %{REQUEST_FILENAME} !-d > > RewriteCond %{REQUEST_FILENAME} !-f > > RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] > > > > > > is not working properly > > > i can access > > -http://IP/app > > -http://IP/app/ > > > and the /webroot/download/ (and /css, /js) folders directly are > > visible, too > > but all controllers+actions are resulting in the following error: > > > "The requested URL /var/www/work/pages/app/webroot/index.php was not > > found on this server." 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: Internationalization in Cakephp help( for a newbie)
On Wed, Dec 9, 2009 at 3:27 AM, Jayanand Bhushi wrote: > Hi all, > > Im newbie to cakephp. But have implemented so many cakephp concept. > Now I want to implement internationalization to my application. > I dont know wat to use. i18n, p28n or l10n. > I even dont the difference between them. Internacionalization: an "i", eighteen letters and a "n", i18n. Localization: an "l", ten letters and a "n", l10n. What's the difference? http://www.google.com.br/search?q=define%3Ai18n http://www.google.com.br/search?q=define%3Al10n p28n is name of a user component to change the language of a CakePHP application based on parameters in the URL. It's described here[1]. > Please give me one sample so that I can continue with it for my modules. Start with the basics [2]. Best regards. [1] http://bakery.cakephp.org/articles/view/p28n-the-top-to-bottom-persistent-internationalization-tutorial [2] http://book.cakephp.org/view/162/Internationalizing-Your-Application -- MARCELO DE F. ANDRADE Belem, PA, Amazonia, Brazil Linux User #221105 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: Function exists
Perfect - thank you John. My code is now: function relations($id = null) { if (method_exists ($this->modelClass,'relations')): return $this->{$this->modelClass}->relations($id); else: return array(); endif; } On Dec 9, 11:26 am, John Andersen wrote: > Hi Jeremy > > Try to use the class/object method "method_exists" instead! > Definition: > > method_exists -- Checks if the class method exists > > Description > bool method_exists ( object object, string method_name) > This function returns TRUE if the method given by method_name has been > defined for the given object, FALSE otherwise. > > Enjoy, > John > > On Dec 9, 10:24 am, Jeremy Burns wrote: > > > > > I want to call a function in a controller from my app_controller, but > > want to check it exists first. I've fiddled around with > > function_exists but can't get the syntax right. This is the current > > version of the code (which doesn't work): > > > function getRelations($id = null) { > > if (function_exists($this->{$this->modelClass}->relations())): > > return $this->{$this->modelClass}->relations($id); > > else: > > return array(); > > endif; > > > } > > > Any ideas? 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: Function exists
Hi Jeremy Try to use the class/object method "method_exists" instead! Definition: method_exists -- Checks if the class method exists Description bool method_exists ( object object, string method_name) This function returns TRUE if the method given by method_name has been defined for the given object, FALSE otherwise. Enjoy, John On Dec 9, 10:24 am, Jeremy Burns wrote: > I want to call a function in a controller from my app_controller, but > want to check it exists first. I've fiddled around with > function_exists but can't get the syntax right. This is the current > version of the code (which doesn't work): > > function getRelations($id = null) { > if (function_exists($this->{$this->modelClass}->relations())): > return $this->{$this->modelClass}->relations($id); > else: > return array(); > endif; > > } > > Any ideas? 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: cakephp can't load CSS and images and all things on Webroot and more
it works now, thank you guys On Dec 9, 7:19 am, ayoub wrote: > yes I did but nothing changes > > On Dec 8, 7:08 am, Pedro Nascimento wrote: > > > on your websites-available, change all AllowOverride none to AllowOverride > > All and comment the env core.php line back. > > > On Tue, Dec 8, 2009 at 01:21, kani wrote: > > > i think you shoud check app/tmp directory and sub directories > > > permission it shoud be 777 > > > > 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.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
Re: shared host setup
worked it out. heres the code i added Debugger::dump($component); Debugger::dump($object); Debugger::dump($parent); output: "Session" UsersController UsersController::$name = "Users" UsersController::$helpers = array UsersController::$components = array UsersController::$here = "/~ha721/users" UsersController::$webroot = "/~ha721/" UsersController::$action = "index" UsersController::$uses = false UsersController::$params = array UsersController::$data = NULL UsersController::$paginate = array UsersController::$viewPath = "users" UsersController::$layoutPath = NULL UsersController::$viewVars = array UsersController::$pageTitle = false UsersController::$modelNames = array UsersController::$base = "/~ha721" UsersController::$layout = "default" UsersController::$autoRender = true UsersController::$autoLayout = true UsersController::$Component = Component object UsersController::$view = "View" UsersController::$ext = ".ctp" UsersController::$output = NULL UsersController::$plugin = NULL UsersController::$cacheAction = false UsersController::$persistModel = false UsersController::$passedArgs = array UsersController::$scaffold = false UsersController::$methods = array UsersController::$modelClass = "User" UsersController::$modelKey = "user" UsersController::$validationErrors = NULL UsersController::$_log = NULL UsersController::$Session = SessionComponent object null "Auth" UsersController UsersController::$name = "Users" UsersController::$helpers = array UsersController::$components = array UsersController::$here = "/~ha721/users" UsersController::$webroot = "/~ha721/" UsersController::$action = "index" UsersController::$uses = false UsersController::$params = array UsersController::$data = NULL UsersController::$paginate = array UsersController::$viewPath = "users" UsersController::$layoutPath = NULL UsersController::$viewVars = array UsersController::$pageTitle = false UsersController::$modelNames = array UsersController::$base = "/~ha721" UsersController::$layout = "default" UsersController::$autoRender = true UsersController::$autoLayout = true UsersController::$Component = Component object UsersController::$view = "View" UsersController::$ext = ".ctp" UsersController::$output = NULL UsersController::$plugin = NULL UsersController::$cacheAction = false UsersController::$persistModel = false UsersController::$passedArgs = array UsersController::$scaffold = false UsersController::$methods = array UsersController::$modelClass = "User" UsersController::$modelKey = "user" UsersController::$validationErrors = NULL UsersController::$_log = NULL UsersController::$Session = SessionComponent object UsersController::$Auth = AuthComponent object null thanks, Alex On Dec 9, 11:00 am, slippy wrote: > hi, > > its cake 1.2.5 and Apache/1.3.34 (Unix) PHP/5.0.5 mod_ssl/2.8.25 > OpenSSL/0.9.7e > > I tried to dump() but not sure where or what to add ? > > Thanks > > Alex > > On Dec 8, 12:47 pm, Dave wrote: > > > What version of php is on your server and which core are you using. > > > On Tue, Dec 8, 2009 at 7:33 AM, Piotr Kilczuk wrote: > > > Hello, > > > > > Thanks for your reply, i have cleared the cache and tired setting > > > > debug to 0 but the error is still there but not showed because debug > > > > is set too zero. > > > > I haven't seen such a bug yet :) > > > > What I'd do, is dig into the Cake core a little. > > > >http://api.cakephp.org/view_source/component/#line-248 > > > 248 if (isset($object->{$component}->components) && > > > is_array($object->{$component}->components) && > > > (!isset($object->{$component}->{$parent}))) { > > > 249 $this->_loadComponents($object->{$component}, $component); > > > 250 } > > > > It's either $component or $parent that is empty I guess. Try dumping > > > that as well as $object with var_dump() to get maximum infos possible. > > > > Depending on what you can use - FTP only or console and version > > > control you have to pick best strategy and debug a little. > > > > Hope this helps... > > > > Regards, > > > Piotr > > > > 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.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
Re: shared host setup
hi, its cake 1.2.5 and Apache/1.3.34 (Unix) PHP/5.0.5 mod_ssl/2.8.25 OpenSSL/0.9.7e I tried to dump() but not sure where or what to add ? Thanks Alex On Dec 8, 12:47 pm, Dave wrote: > What version of php is on your server and which core are you using. > > On Tue, Dec 8, 2009 at 7:33 AM, Piotr Kilczuk wrote: > > Hello, > > > > Thanks for your reply, i have cleared the cache and tired setting > > > debug to 0 but the error is still there but not showed because debug > > > is set too zero. > > > I haven't seen such a bug yet :) > > > What I'd do, is dig into the Cake core a little. > > >http://api.cakephp.org/view_source/component/#line-248 > > 248 if (isset($object->{$component}->components) && > > is_array($object->{$component}->components) && > > (!isset($object->{$component}->{$parent}))) { > > 249 $this->_loadComponents($object->{$component}, $component); > > 250 } > > > It's either $component or $parent that is empty I guess. Try dumping > > that as well as $object with var_dump() to get maximum infos possible. > > > Depending on what you can use - FTP only or console and version > > control you have to pick best strategy and debug a little. > > > Hope this helps... > > > Regards, > > Piotr > > > 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.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
index function question
Hi guys. I have a question, I am defining my index function but I am struggling a bit with something. I want to have my index function only show all records in my index with the associated users id. How does one go about this? here is what I have: function index() { $conditions = $this->Health->find('first', array('conditions' => array('Health.id' => '1'))); $this->set('healths', $conditions, $this->paginate()); } your reply and time is much appreciated. 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: 404 Not Found Error
And as an alternative place to check, what's the action for your form (did you start the form with $form->create('User'); ?) On Dec 8, 2:55 pm, Dave wrote: > What is the code for your redirect at the end of your add method > > > > > > On Mon, Dec 7, 2009 at 11:20 PM, Dave wrote: > > Any idea why this would happen? > > site/admin/users/add when i go to that page it works fine. Add a new user > > which goes to site/admin/users/add and I get 404 Error. > > > The page is obviously there and accessible since im on the page adding a > > user but when i post the data it comes back 404. > > > Any ideas why this might happen? > > > Dave > > > 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.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
Re: Use of Multiple Fields in $displayField var in Models
As an example for multiple displayField, this is how I change (e.g. translate) my displayField for my Gender dropdowns. http://github.com/ionas/sna/blob/master/www/app/app_model.php#L12 http://github.com/ionas/sna/blob/master/www/app/models/gender.php#L10 Skip the translation part by removing the inner conditions and foreach loop in the app_models find overwrite In the Gender Model one could easily add {n}.Gender.id to show id next to name. var $displayField = array('%s %s', '{n}.Gender.id', '{n}.Gender.label'); Works I think On Dec 8, 5:52 pm, Marco wrote: > Yes, it is what Marcelo already mentioned. > > On Dec 8, 10:56 am, Dave wrote: > > > I asked about this a while ago and I know there is a multiple displayField > > behavior in the bakery > > > On Mon, Dec 7, 2009 at 8:12 PM, Marcelo Andrade wrote: > > > On Mon, Dec 7, 2009 at 2:44 AM, Mohammad Raheel > > > wrote: > > > > I want to use 2 Concatenated fields in $displayField variable in a > > > > model so that the view can show both FirstName and LastName in the > > > > dropdown selection. > > > > > var $displayField = "firstName"; > > > > > I need something like > > > > var $displayField = "firstName"." "."lastName"; > > > > This is not the correct syntax. About using more > > > than one field in displayField, I've found this old > > > ticket[1] and this article at bakery[2]. > > > > But, as Marco said, Set::combine is so powerfull. > > > Maybe you should give it a try. > > > > [1]https://trac.cakephp.org/ticket/644 > > > [2]http://bakery.cakephp.org/articles/view/multiple-display-field-3 > > > > Atenciosamente. > > > > -- > > > MARCELO DE F. ANDRADE > > > Belem, PA, Amazonia, Brazil > > > Linux User #221105 > > > > 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 > > om>For 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
Function exists
I want to call a function in a controller from my app_controller, but want to check it exists first. I've fiddled around with function_exists but can't get the syntax right. This is the current version of the code (which doesn't work): function getRelations($id = null) { if (function_exists($this->{$this->modelClass}->relations())): return $this->{$this->modelClass}->relations($id); else: return array(); endif; } Any ideas? 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: form->input keeps value after submit is presed
I want to redirect to /posts/view/Id_view. So my code shoul look like: [code] $this->render('url'=>'/posts/view'.$this->data['Post']['id'],'ajax'); [/code] Is this the correct way? - Andrei Bogdan 2009/12/9 Dave : > Don't render add_success, redirect to the action you want > > On Tue, Dec 8, 2009 at 4:07 PM, Andrei BOGDAN > wrote: >> >> Hello, >> My add action in comments_controller looks like this now: >> [code] >> function add() { >> if (!empty($this->data)) { >> if ($this->Comment->save($this->data)) { >> $comments = $this->Comment->find('all', >> array('conditions' => >> array('post_id' => $this->data['Comment']['post_id']), 'recursive' => >> -1)); >> unset($this->data['Comment']); >> $this->data = $this->Comment->create(); >> $this->set(compact('comments')); >> $this->render('add_succes','ajax'); >> } else { $his->render('add_failure','ajax');} >> } >> } >> [/code] >> I used with firebug to debug the app and I saw that when I render >> 'add_succes' $_POST keeps the old values instead of clearing them. >> >> - >> Andrei Bogdan >> >> >> >> >> 2009/12/8 John Andersen : >> > Ok, sorry, didn't see you were using the $this->data variable later >> > inside the if statement, so please move the statement: >> > >> > $this->data = $this->Comment->create(); >> > >> > after your find statement. The find statement uses the data from the >> > $this->data variable! >> > >> > Tell us if the above fixes your problem, or what Chickenhen wrote did! >> > Enjoy, >> > John >> > >> > On Dec 7, 10:00 pm, Andrei BOGDAN >> > wrote: >> >> I've change my code and the add action from comments controller looks >> >> like this: >> >> [code] >> >> function add() { >> >> if (!empty($this->data)) { >> >> if ($this->Comment->save($this->data)) { >> >> $this->data = $this->Comment->create(); >> >> $comments = $this->Comment->find('all', >> >> array('conditions' => >> >> array('post_id' => $this->data['Comment']['post_id']), 'recursive' => >> >> -1)); >> >> $this->set(compact('comments')); >> >> $this->render('add_succes','ajax'); >> >> } else { $his->render('add_failure','ajax');} >> >> } >> >> } >> >> [/code] >> > [snip] >> > >> > 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 >> > >> >> 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 > > 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 > 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: form->input keeps value after submit is presed
My post/view.ctp looks like this: [code] link(''.$post['Post']['name'].'','/posts/view/'.$post['Post']['id'],null,null,false);?> Author: Date Published: nice($post['Post']['date'], null);?> :: Comments :: link('up','/comments/vote/up/'.$comment['Comment']['id'],array('update'=>'vote_'.$comment['Comment']['id']),null,false);?> link('down','/comments/vote/down/'.$comment['Comment']['id'],array('update'=>'vote_'.$comment['Comment']['id']),null,false);?> create('Comment',array('action'=>'add','onSubmit'=>'return false;'));?> input('Comment.name');?> input('Comment.content');?> input('Comment.post_id', array('type'=>'hidden','value'=>$post['Post']['id']));?> submit('Add Comment', array('url'=>'/comments/add','update'=>'comments'));?> [/code] >> > My add action in comments_controller looks like this now: [code] function add() { if (!empty($this->data)) { if ($this->Comment->save($this->data)) { $comments = $this->Comment->find('all', array('conditions' => array('post_id' => $this->data['Comment']['post_id']), 'recursive' => -1)); unset($this->data['Comment']); $this->data = $this->Comment->create(); $this->set(compact('comments')); $this->render('add_succes','ajax'); } else { $his->render('add_failure','ajax');} } } [/code] - Andrei Bogdan 2009/12/9 Jayanand Bhushi : > Hi, > > Here I am sending you my two files. view and controller. > Please lemme know what is the best way. > > Thanks, > Jayanand Bhushi > > > On Wed, Dec 9, 2009 at 12:23 PM, John Andersen > wrote: >> >> Are you using $_POST to fill out your view? >> Please show the code from your view and/or elements that your present! >> Enjoy, >> John >> >> On Dec 8, 11:07 pm, Andrei BOGDAN >> wrote: >> > Hello, >> > My add action in comments_controller looks like this now: >> > [code] >> > function add() { >> > if (!empty($this->data)) { >> > if ($this->Comment->save($this->data)) { >> > $comments = $this->Comment->find('all', >> > array('conditions' => >> > array('post_id' => $this->data['Comment']['post_id']), 'recursive' => >> > -1)); >> > unset($this->data['Comment']); >> > $this->data = $this->Comment->create(); >> > $this->set(compact('comments')); >> > $this->render('add_succes','ajax'); >> > } else { $his->render('add_failure','ajax');} >> > } >> > } >> > [/code] >> > I used with firebug to debug the app and I saw that when I render >> > 'add_succes' $_POST keeps the old values instead of clearing them. >> > >> > - >> > Andrei Bogdan >> > >> > 2009/12/8 John Andersen : >> > >> > > Ok, sorry, didn't see you were using the $this->data variable later >> > > inside the if statement, so please move the statement: >> > >> > > $this->data = $this->Comment->create(); >> > >> > > after your find statement. The find statement uses the data from the >> > > $this->data variable! >> > >> > > Tell us if the above fixes your problem, or what Chickenhen wrote did! >> > > Enjoy, >> > > John >> > >> > > On Dec 7, 10:00 pm, Andrei BOGDAN >> > > wrote: >> > >> I've change my code and the add action from comments controller looks >> > >> like this: >> > >> [code] >> > >> function add() { >> > >> if (!empty($this->data)) { >> > >> if ($this->Comment->save($this->data)) { >> > >> $this->data = $this->Comment->create(); >> > >> $comments = $this->Comment->find('all', >> > >> array('conditions' => >> > >> array('post_id' => $this->data['Comment']['post_id']), 'recursive' => >> > >> -1)); >> > >> $this->set(compact('comments')); >> > >> $this->render('add_succes','ajax'); >> > >> } else { $his->render('add_failure','ajax');} >> > >> } >> > >> } >> > >> [/code] >> > > [snip] >> > >> > > 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 >> >> Check out the new CakePHP Questions site http://cakeqs.org and help others >> with their CakePHP related questions. >> >> You received this