Thursday, January 24, 2013

Re: Save Uploaded/Parsed File to Database Table

And I am suppose to set the Model ID in the controller right?

On Wednesday, January 23, 2013 12:56:15 PM UTC-6, cricket wrote:
On Wed, Jan 23, 2013 at 11:41 AM, Karl Smith <barn...@hotmail.com> wrote:
> I just want to verify that my logic is right before I move forward.......If
> I use <?php echo $this->UiForm->input('id', array('type' => 'hidden'));  to
> pass my id to my controller....the id will be automagically added to my
> $data array...correct?

Not exactly. FormHelper populates inputs based on what's in
$this->request->data. But since you're not trying to populate an
entire form so as to edit the record, you can just do this:

$this->set('model_id', $model_id);

view:

echo $form->hidden('Model.id', array('value' => $model_id));

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
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.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
 
 

No comments: