Cake PHP Form Helper


#1

Hi,

Can someone hep me and tell me how he form helper should look in order to generate the following HTML:

<div class="form-group">
   <label for="input-Default" class="col-sm-2 control-label">Default</label>
       <div class="col-sm-10">
             <input type="text" class="form-control" id="input-Default">
       </div>
  </div>

Thanks


#2

The form helper isn’t really flexible enough to allow for any kind of structure, but you could create your own form templates as described here:

http://book.cakephp.org/3.0/en/views/helpers/form.html#customizing-the-templates-formhelper-uses

However, this is only sensible if you really plan on using these new structures all the time in your project. If it’s a one time thing, it makes more sense to just use HTML and fill it with the appropriate variables or create a helper.


#3

Looks like you can use Holt59’s CakePHP 3.x Helpers for Bootstrap

Also in the thrid parameter, any non-special key (like values for a select) remain as an attribute for the element


#4

Thanks @ali :grinning: 100% helpful for me