开发者

$this -> Form -> end () does not process options array correctly

开发者 https://www.devze.com 2023-03-09 00:48 出处:网络
I have a problem with the Form helper in CakePHP 1.3. The form opening and inputs are generated correctly, however, my Form -> end () function doesn\'t do what I expect (and want) it to do.

I have a problem with the Form helper in CakePHP 1.3. The form opening and inputs are generated correctly, however, my Form -> end () function doesn't do what I expect (and want) it to do.

This is my code for the end tag:

<?php echo $this -> Form -> end (array (
                                         'value'  => 'registreer',
                                         'id'     => 'register_button'
                                       )
                                ) ?>

This is the way the CakePHP API describes the use of the Form helper. However, it doesn't work and Cake just substitutes my options with the defaults.

When I change my code to $this -> Form -> end ('registreer') the value is set to 'registreer', but I really need to set an ID for this input, so I need the array to work.

I have looked through the Cake 1.3 Book and the API and I searched Google. Unfortunately Google's mostly gives me Cake 1.2 search results so I can't find an answer to my question online.

Does any of you guys ha开发者_运维问答ve any idea how to get my form closing correctly?

Thanks in advance!


It's a bit unclear in the documentation, but You have to specify the label option to the array.

echo $this->Form->end(array(
  'label' => 'registreer',
  'id' => 'register_button'
  ));

http://book.cakephp.org/view/1389/Closing-the-Form

http://api13.cakephp.org/class/form-helper#method-FormHelperend

0

精彩评论

暂无评论...
验证码 换一张
取 消