Re: FormHelper Problem
No problem cricket. I appreciates all the responses. (Miles and Tilen too) The first thing I tried was to redirect but this has its own problems. $this->data was no longer available after the redirect, meaning it was empty. It also caused problems with AuthComponent because function beforeFilter() will allow access to the form action only if the HTTP_REFERER is the form page. The solution that works for now is I moved the form to the same controller as the form action, which is : array('controller' => 'contact_requests', 'action' => 'index'). Maybe having the form on the pages controller was the source of the problem, but I don't understand why this should be an issue. On Dec 20, 5:19 pm, cricket wrote: > On Mon, Dec 20, 2010 at 3:37 PM, Miles J wrote: > > @Cricket - Since when is that possible? I know you can use action as a > > parameter, but if you want to define a full route, you must use url. > Since I made it up, apparently. You're right. I wasn't thinking about > that clearly. Sorry, georgeman. 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: FormHelper Problem
On Mon, Dec 20, 2010 at 3:37 PM, Miles J wrote: > @Cricket - Since when is that possible? I know you can use action as a > parameter, but if you want to define a full route, you must use url. Since I made it up, apparently. You're right. I wasn't thinking about that clearly. Sorry, georgeman. 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: FormHelper Problem
Miles, you're right, and georgeman, this what u did, should work, look source code, if form is correctly generated, maybe you have in "add" method in controller any redirect or something -- Lep pozdrav, Tilen Majerle http://majerle.eu 2010/12/20 Miles J > @Cricket - Since when is that possible? I know you can use action as a > parameter, but if you want to define a full route, you must use url. > > On Dec 20, 12:06 pm, cricket wrote: > > You don't need to specify url: > > > > echo $this->Form->create( > > 'ContactRequest', > > array('controller' => 'contact_requests', 'action' => 'add') > > ); > > > > On Sun, Dec 19, 2010 at 10:15 PM, georgeman > wrote: > > > I built a simple contact request form using FormHelper. The form is > > > located on 'pages/contact' and the form action is located on > > > 'contact_requests/add'. The form handler will email the request to the > > > address set by the administrator, and will save a copy of the request > > > to the database. > > > > > To create the form I wrote the following: > > > > > Form->create('ContactRequest', array('url' => > > > array('controller' => 'contact_requests', 'action' => 'add')); ?> > > > > > When I click submit, instead of being brought to 'contact_requests/ > > > add' I am brought to 'contact_requests/'. I have tried to write the > > > url in the form of address and this didn't help. The only other info I > > > can give is the first few times I tested the form it worked as > > > expected, but after a few times, the new (wrong) behavior came along > > > and won't go away. > > > > > Here is the rest of the code for the form. Does anyone know what the > > > problem could be? > > > > > Form->create('ContactRequest', array('url' => > > > 'http://localhost/trial/contact_requests/add', 'div' => false));?> > > > Form->input('ContactRequest.name', array('label' => > > > 'Name:', 'type' => 'text', 'maxLength' => '50', 'div' => false));?> > > > Form->input('ContactRequest.email', array('label' => > > > 'Email:', 'type' => 'text', 'maxLength' => '50', 'placeholder' => > > > '@email.com', 'div' => false));?> > > > Form->input('ContactRequest.phone', array('label' => > > > 'Phone:', 'type' => 'tel', 'maxLength' => '13', 'placeholder' => 'XXX- > > > XXX-', 'div' => false));?> > > > Form->input('ContactRequest.ext', array('label' => > > > 'Extension:', 'type' => 'text', 'name' => 'ext', 'maxLength' => '5', > > > 'div' => false));?> > > > Form->label('Message:');?> > > > Form->textarea('ContactRequest.message', > > > array('maxLength' => '100', 'wrap' => 'soft', 'placeholder' => > > > 'maximum 100 characters', 'div' => false));?> > > > Form->button('Submit');?> > > > Form->end();?> > > > > > Form->input('ContactRequest.name', array('label' => > > > 'Name:', 'type' => 'text', 'maxLength' => '50', 'div' => false));?> > > > Form->input('ContactRequest.email', array('label' => > > > 'Email:', 'type' => 'text', 'maxLength' => '50', 'placeholder' => > > > '@email.com', 'div' => false));?> > > > Form->input('ContactRequest.phone', array('label' => > > > 'Phone:', 'type' => 'tel', 'maxLength' => '13', 'placeholder' => 'XXX- > > > XXX-', 'div' => false));?> > > > Form->input('ContactRequest.ext', array('label' => > > > 'Extension:', 'type' => 'text', 'name' => 'ext', 'maxLength' => '5', > > > 'div' => false));?> > > > Form->label('Message:');?> > > > Form->textarea('ContactRequest.message', > > > array('maxLength' => '100', 'wrap' => 'soft', 'placeholder' => > > > 'maximum 100 characters', 'div' => false));?> > > > Form->button('Submit');?> > > > Form->end();?> > > > > > 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 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.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: FormHelper Problem
@Cricket - Since when is that possible? I know you can use action as a parameter, but if you want to define a full route, you must use url. On Dec 20, 12:06 pm, cricket wrote: > You don't need to specify url: > > echo $this->Form->create( > 'ContactRequest', > array('controller' => 'contact_requests', 'action' => 'add') > ); > > On Sun, Dec 19, 2010 at 10:15 PM, georgeman wrote: > > I built a simple contact request form using FormHelper. The form is > > located on 'pages/contact' and the form action is located on > > 'contact_requests/add'. The form handler will email the request to the > > address set by the administrator, and will save a copy of the request > > to the database. > > > To create the form I wrote the following: > > > Form->create('ContactRequest', array('url' => > > array('controller' => 'contact_requests', 'action' => 'add')); ?> > > > When I click submit, instead of being brought to 'contact_requests/ > > add' I am brought to 'contact_requests/'. I have tried to write the > > url in the form of address and this didn't help. The only other info I > > can give is the first few times I tested the form it worked as > > expected, but after a few times, the new (wrong) behavior came along > > and won't go away. > > > Here is the rest of the code for the form. Does anyone know what the > > problem could be? > > > Form->create('ContactRequest', array('url' => > > 'http://localhost/trial/contact_requests/add', 'div' => false));?> > > Form->input('ContactRequest.name', array('label' => > > 'Name:', 'type' => 'text', 'maxLength' => '50', 'div' => false));?> > > Form->input('ContactRequest.email', array('label' => > > 'Email:', 'type' => 'text', 'maxLength' => '50', 'placeholder' => > > '@email.com', 'div' => false));?> > > Form->input('ContactRequest.phone', array('label' => > > 'Phone:', 'type' => 'tel', 'maxLength' => '13', 'placeholder' => 'XXX- > > XXX-', 'div' => false));?> > > Form->input('ContactRequest.ext', array('label' => > > 'Extension:', 'type' => 'text', 'name' => 'ext', 'maxLength' => '5', > > 'div' => false));?> > > Form->label('Message:');?> > > Form->textarea('ContactRequest.message', > > array('maxLength' => '100', 'wrap' => 'soft', 'placeholder' => > > 'maximum 100 characters', 'div' => false));?> > > Form->button('Submit');?> > > Form->end();?> > > > Form->input('ContactRequest.name', array('label' => > > 'Name:', 'type' => 'text', 'maxLength' => '50', 'div' => false));?> > > Form->input('ContactRequest.email', array('label' => > > 'Email:', 'type' => 'text', 'maxLength' => '50', 'placeholder' => > > '@email.com', 'div' => false));?> > > Form->input('ContactRequest.phone', array('label' => > > 'Phone:', 'type' => 'tel', 'maxLength' => '13', 'placeholder' => 'XXX- > > XXX-', 'div' => false));?> > > Form->input('ContactRequest.ext', array('label' => > > 'Extension:', 'type' => 'text', 'name' => 'ext', 'maxLength' => '5', > > 'div' => false));?> > > Form->label('Message:');?> > > Form->textarea('ContactRequest.message', > > array('maxLength' => '100', 'wrap' => 'soft', 'placeholder' => > > 'maximum 100 characters', 'div' => false));?> > > Form->button('Submit');?> > > Form->end();?> > > > 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 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: FormHelper Problem
You don't need to specify url: echo $this->Form->create( 'ContactRequest', array('controller' => 'contact_requests', 'action' => 'add') ); On Sun, Dec 19, 2010 at 10:15 PM, georgeman wrote: > I built a simple contact request form using FormHelper. The form is > located on 'pages/contact' and the form action is located on > 'contact_requests/add'. The form handler will email the request to the > address set by the administrator, and will save a copy of the request > to the database. > > To create the form I wrote the following: > > Form->create('ContactRequest', array('url' => > array('controller' => 'contact_requests', 'action' => 'add')); ?> > > When I click submit, instead of being brought to 'contact_requests/ > add' I am brought to 'contact_requests/'. I have tried to write the > url in the form of address and this didn't help. The only other info I > can give is the first few times I tested the form it worked as > expected, but after a few times, the new (wrong) behavior came along > and won't go away. > > Here is the rest of the code for the form. Does anyone know what the > problem could be? > > Form->create('ContactRequest', array('url' => > 'http://localhost/trial/contact_requests/add', 'div' => false));?> > Form->input('ContactRequest.name', array('label' => > 'Name:', 'type' => 'text', 'maxLength' => '50', 'div' => false));?> > Form->input('ContactRequest.email', array('label' => > 'Email:', 'type' => 'text', 'maxLength' => '50', 'placeholder' => > 'y...@email.com', 'div' => false));?> > Form->input('ContactRequest.phone', array('label' => > 'Phone:', 'type' => 'tel', 'maxLength' => '13', 'placeholder' => 'XXX- > XXX-', 'div' => false));?> > Form->input('ContactRequest.ext', array('label' => > 'Extension:', 'type' => 'text', 'name' => 'ext', 'maxLength' => '5', > 'div' => false));?> > Form->label('Message:');?> > Form->textarea('ContactRequest.message', > array('maxLength' => '100', 'wrap' => 'soft', 'placeholder' => > 'maximum 100 characters', 'div' => false));?> > Form->button('Submit');?> > Form->end();?> > > > > > > > > > Form->input('ContactRequest.name', array('label' => > 'Name:', 'type' => 'text', 'maxLength' => '50', 'div' => false));?> > Form->input('ContactRequest.email', array('label' => > 'Email:', 'type' => 'text', 'maxLength' => '50', 'placeholder' => > 'y...@email.com', 'div' => false));?> > Form->input('ContactRequest.phone', array('label' => > 'Phone:', 'type' => 'tel', 'maxLength' => '13', 'placeholder' => 'XXX- > XXX-', 'div' => false));?> > Form->input('ContactRequest.ext', array('label' => > 'Extension:', 'type' => 'text', 'name' => 'ext', 'maxLength' => '5', > 'div' => false));?> > Form->label('Message:');?> > Form->textarea('ContactRequest.message', > array('maxLength' => '100', 'wrap' => 'soft', 'placeholder' => > 'maximum 100 characters', 'div' => false));?> > Form->button('Submit');?> > Form->end();?> > > 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