I'm upgrading a system from CakePHP 1.1 to CakePHP 1.3. In 1.1 I was able to use the HTML helper to do something like:
$html->input('User/email');
To get back data nested in:
$this->data['User']['email']
In the controller. Now I know that $html->input()
has been replaced with $this->Form->input()
. However, when I try to use:
$this->Form->input('User/email')
I get:
Undefined offset: 2 [CORE\cake\libs\view\helpers\form.php, line 496]
This is coming up because the /
in the input. So it seems that 1.3 doesn't like using the /
to specify the data should be returned nested. How might I achieve the equivalent of this in 1.3? Thank you much!
In 1.3 you would use
$this->Form->input('User.email');
To set an input for the User model and the email field.
If you have set up your form correctly though, you just need email
For example
$this->Form->create('User');
$this->Form->input('email');
$this->Form->end('Submit');
But in short, to answer your specific question, replace the / with a .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.