Twitter bootstrap forms in CakePHP 3

Wrote about how to get Twitter bootstrap forms in CakePHP 3. Twitter bootstrap is probably the most popular of the CSS frameworks, getting to know how to manipulate the CakePHP 3 forms to use it is a useful thing to know.

So what are the thumb rules for using custom templates, Widgets and form helpers? For me

– Only markup changes – change just templates
– Conditional markup, amalgamation of input fields (think datetime inputs) – create widgets
– Additional processing of data, change in defaults like no label, no HTML 5 require checks by default – mess with custom form helper

Read the blog post

2 thoughts on “Twitter bootstrap forms in CakePHP 3

  1. kyle rebstock says:

    Regards Tarique Sani,

    This is an interesting post as I am currently working with custom form templates for work. I recently spoke to Jose Zap of the Cake team and he recommended that we either use a bootstrap plugin or rewrite up some widgets and pass them into the form helper. I can’t seem to find any examples of multiple custom form templates anywhere.(even with using the widgets.) If you can shed some light on this problem it would be greatly appreciated. Thanks in advance sir!

    • Tarique Sani says:

      If you read the original post you can see that step 2 shows how to use form templates. I don’t think you can use multiple form templates unless you want to be defining them at run time in your code. The manul has an example of how to do this.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>