Is there any way to force change the model that helpers use? I'm
trying to get a form from one model populating inside a view for
another.

For instance, the value field in a form is filled by the value
function in /cake/libs/helper.php.

The following line (478) checks for suitable data to populate a form
with:

if (isset($this->data[$this->model()][$this->field()])) {

Just before that line, I'll put some test code in:

if (isset($this->data)) {
$result .= "we have data!";
}
else{
$result .="we don't have data!";
}

Calling it from the URL /users/edit/5, returns a positive result, but
from /articles/index won't, even though the form I want to populate
(and thus that the helper needs to scout the data for) is embedded in
the same page.

My form code is this:

$this->data = requestaction('/users/edit/5');
echo $form->create('User', array('url' => '/users/edit/'.$my_id'));?>
echo $form->input('User.id');
echo $form->input('User.content');

The requestAction nicely returns the data, but the form helpers don't
notice it as they are looking at a higher level for direction on which
model/controller to focus on. Is there any way to divert the helper to
look at something else? I know I could use:
echo $form->input('id',array('value'=>$this->data['User']['id']));

But it would be nice if there was a way for $form->input('id') to work
without having to manually set everything.

Any ideas?

Any suggestions?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to