Re: Good idea to combine edit.thtml and add.thtml?
Thanks RichardAtHome, this was exactly what I was mean with combining the forms. It's great to see that 1.2 will make coding with CakePHP even more pleasant! Keep up the good work! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Good idea to combine edit.thtml and add.thtml?
If you set the action property of the form to empty ( "" ) then the form will post back to the page that it was rendered on. Handy if you are passing parameters through the url. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Good idea to combine edit.thtml and add.thtml?
http://cake.insertdesignhere.com/posts/view/15 Read the comments. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Good idea to combine edit.thtml and add.thtml?
In my views I do one better and incorporate a type of 'view' as well - with things like $form = "" and $disabled = "disabled" So I can re-use one view for all 3 modes. Steve Truesdale On Jan 21, 3:37 pm, "Larry E. Masters aka PhpNut" <[EMAIL PROTECTED]> wrote: > Barton, > > This is how the core scaffold uses one form template. The code below is from > 1.1.x.x branch. > > snips are from different files but it should give you a good idea how to > accomplish this. > > controller file: > > $form = 'Edit'; > if ($type === 'add') { > $form = 'Add'; > } > > $this->set('type', $form); > > view file: > > if($type == 'Edit') { > echo $html->formTag($path . Inflector::underscore($this->name) > .'/update'); > //Add you hidden tag for the id here. Scaffold does it automatically so > it is not shown here} else {echo $html->formTag($path. > Inflector::underscore($this->name).'/create'); > > }-- > /** > * @author Larry E. Masters > * @var string $userName > * @param string $realName > * @returns string aka PhpNut > * @access public > */ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Good idea to combine edit.thtml and add.thtml?
Hi Barton, I usually have two methods in my controller: add (or create) and edit. In these methods I use $this->render('form'). In my form.thtml I have formTag('/'.Inflector::underscore($this->name).'/'.$this->action);?> and of course hidden('Modelname/id'); ?> (needed for editing). It's a little bit shorter, I think. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Good idea to combine edit.thtml and add.thtml?
Barton, This is how the core scaffold uses one form template. The code below is from 1.1.x.x branch. snips are from different files but it should give you a good idea how to accomplish this. controller file: $form = 'Edit'; if ($type === 'add') { $form = 'Add'; } $this->set('type', $form); view file: formTag($path . Inflector::underscore($this->name) .'/update'); //Add you hidden tag for the id here. Scaffold does it automatically so it is not shown here } else { echo $html->formTag($path. Inflector::underscore($this->name).'/create'); } -- /** * @author Larry E. Masters * @var string $userName * @param string $realName * @returns string aka PhpNut * @access public */ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Good idea to combine edit.thtml and add.thtml?
I wonder whether it's a good idea to combine the 'add' and 'edit' forms into one form. What's your opinion about this? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---