rrd
rrd

Reputation: 1451

CakePHP 3 form template set to default

I have 2 forms in a page.

For the 1sz one I do not want to use templates, for the 2nd I want. So for the 2nd form I use this.

echo $this->Form->create();
$this->Form->templates([
    'inputContainer' => '<div class="thin">{{content}}</div>'
     ]);

It seems this template is applied to the 1st form also. How to prevent this?

Upvotes: 0

Views: 531

Answers (1)

ndm
ndm

Reputation: 60503

By passing the templates you want to use for that specific form to the corresponding create() call.

echo $this->Form->create(null, [
    'templates' => [
        'inputContainer' => '<div class="thin">{{content}}</div>'
    ]
]);

http://api.cakephp.org/3.0/class-Cake.View.Helper.FormHelper.html#_create

Upvotes: 1

Related Questions