Closed tgoeminne closed 10 hours ago
hi any reply on this I am trying to figure out how this plugin works but have hard time fixing it..
$templates = [ 'inputGroupContainer' =>'<div{{attrs}}>{{prepend}}{{content}}{{append}}{{extra}}
I am using this but with no luck all that happen is the extra
echo $this->Form->control('name', ['label' => 'Name', 'extra' => 'how are you doing?' , 'templates' => $templates]);
expected result:
actual
Can tell me what I am doing wrong here?
greets, Thomas
Also it would appear that the error messages are no longer shown on text inputs? Is this broken ?
You cannot add custom templates like that, the underlying string template functionality provided by CakePHP doesn't support that. What you can do however is adding template variables:
$this->Form->setTemplates([
'inputContainer' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}form-group {{type}}{{required}}">{{content}}{{help}}{{extra}}</div>',
'inputContainerError' =>
'<div{{containerAttrs}} ' .
'class="{{containerClass}}form-group {{formGroupPosition}}{{type}}{{required}} is-invalid">' .
'{{content}}{{error}}{{help}}{{extra}}</div>',
]);
// ...
echo $this->Form->control('name', [
'label' => 'Name',
'templateVars' => [
'extra' => 'how are you doing?'
],
]);
thanks, will take a look at that
Hi,
I want to add content at the end of a form control. eg another hidden input. I can use the help option but then it will be inside the small container. Is there another option I am overlooking?