开发者

Form->end without a div in CakePHP

开发者 https://www.devze.com 2023-03-13 16:50 出处:网络
I\'d like to create a submit button that does NOT have a <div> around it.I assumed using the inputDefaults would make this happen like it does for all of the forms inputs, but - no luck.

I'd like to create a submit button that does NOT have a <div> around it. I assumed using the inputDefaults would make this happen like it does for all of the forms inputs, but - no luck.

Obviously I could just create a submit button via HTML, wit开发者_JS百科hout CakePHP, but - I was hoping there'd be a cake answer. Here's what I've tried:

$this->Form->create(false, array('inputDefaults' => array('div'=>false)));
$this->Form->end('Submit');


echo $this->Form->submit('Submit', array('div'=>false));

Should do what you are after. The other example may have been Cake 1.2 or something; not sure.

It also appears you can just do this instead:

<?php 
$options = array(
    'label' => 'Update',
    'value' => 'Update!',
    'div' => false
    )
);
echo $this->Form->end($options);

That looks more cakey.

0

精彩评论

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