Thursday, January 21, 2010

Re: Non-database fields in view

Okay, I've narrowed this down more.

I'm actually trying to render an array, one member at a time. So, $form->input("something[$i]") doesn't work. I've verified the data is there, by simply doing $form->input("something") and a single field is rendered as a drop down list. I have even tried, in the view, to loop through the array and set a single variable to the current member and then do a set(), but the value doesn't seem to be available.

So, the question is, how do I render an array one member at a time?


Ernesto wrote:
try this  in view  $form->input("something_1"); $form->input("something_2");  in controller action  if (!empty($this->data)) {      $something_1 = $this->data[$this->modelClass]["something_1"]; // first field      $something_2 = $this->data[$this->modelClass]["something_2"]; // second field }  On 20 Gen, 00:49, laceja <mkings...@weblinesys.com> wrote:   
I need to add a few input fields to a view. I'm thinking to create the variables in the controller and then pass them to the view, but I don't really understand how to do it. If someone could offer me a short/simple example, I would appreciate it very much.  Thank you.     
 
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

--  Merrill Kingston Phone: 702.798.1806 Fax: 702.522.1455

No comments: