Cakephp 3.0 Change Or Remove Wrapping Div On Input Form
I am trying to remove or change the wrapping div that CakePHP uses on its form helper. When I use this code: echo $this->Form->input('contact', ['label' => false]); The
Solution 1:
I'm working with a UI purchased and there have been several problems with cakephp3. For me it is not so easy to remove the <div>
initial, most to the solution provided here, after much testing:
echo$this->Form->control('username', [
'templates' => ['inputContainer' => '{{content}}'],
"type" => "text",
"aria-invalid" => "false",
"aria-required" => "true",
"class" => "form-control valid",
"placeholder" => "Ingrese su usuario o email ...",
"autocomplete" => "on",
'label' => false
]);
the result
<input name="username" aria-invalid="false" aria-required="true"class="form-control valid" placeholder="Ingrese su usuario o email ..." autocomplete="on"id="username"type="text">
only adds an input tag (sorry for my Google-English)
Solution 2:
I think it is a better way to define the templates global in the config folder:
<?=$this->Form->create($user, array(
"class" => "ui form",
"templates" => "semantic"// The filename in your config folder without .php
)); ?>
In the config folder create the file "semantic.php" (You can name it to whatever you want) with the content:
return array(
"inputContainer" => '{{content}}'// Here the magic happens
);
Hope this helps!
Post a Comment for "Cakephp 3.0 Change Or Remove Wrapping Div On Input Form"