开发者

How to add label to "file upload" input?

开发者 https://www.devze.com 2023-03-26 17:59 出处:网络
In my code I have something like开发者_开发百科 this: echo $this->Form->input(\'name\'); echo $this->Form->input(\'app_code\');

In my code I have something like开发者_开发百科 this:

echo $this->Form->input('name');
echo $this->Form->input('app_code');
echo $this->Form->file('icon');
echo $this->Form->input('description');

And the form looks like this:

How to add label to "file upload" input?

As you can see, the file input does not have a label like the other input text fields. How can I add one (without having to create the HTML manually)?


$this->Form->input('icon', array('label' => 'Your label', 'type' => 'file'));

Relevant info from the book


You can use $this->Form->input for various types. It defaults to text inputs, but will do much more.

echo $this->Form->input('icon', array('type' => 'file'));

There's more information in the cookbook.


have a look at the api here http://api13.cakephp.org/class/form-helper#method-FormHelperinput it is bound to be helpful in the future.

0

精彩评论

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