Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormHelper Customized Templates - checkboxFormGroup #6318

Closed
gauravmak opened this issue Apr 11, 2015 · 9 comments
Closed

FormHelper Customized Templates - checkboxFormGroup #6318

gauravmak opened this issue Apr 11, 2015 · 9 comments
Milestone

Comments

@gauravmak
Copy link

checkboxFormGroup is generating a Notice for {{input}} -> Notice (8): Array to string conversion [CORE\src\View\StringTemplate.php, line 216]

My code attached...
formhelper customized templates - checkboxformgroup

Secondly, there is no way to customize the label of the checkbox. Any possibility for that?

@ADmad
Copy link
Member

ADmad commented Apr 11, 2015

For checkbox the input gets nested inside the label so you shouldn't have {{input}} placeholder in your checkboxFromGroup template.

Seems you are trying to customize the templates for bootstrap. I would suggest using the Bootstrap UI plugin.

@ADmad ADmad added this to the 3.0.2 milestone Apr 11, 2015
@gauravmak
Copy link
Author

Thank you @ADmad,

The doc needs an update then I guees - http://book.cakephp.org/3.0/en/views/helpers/form.html#list-of-templates

Yes am using bootsrap, but I already have a template which I need to integrate with the app.
I will wait for the update to be able to customize the checkbox label then.
It is already doing 2 jobs though - Adding hidden element and the checkbox input.

@ADmad
Copy link
Member

ADmad commented Apr 11, 2015

For checkboxes by default the nestingLabel template is used. It's currently not listed on the manual page you linked but I have opened a PR cakephp/docs#2622 to fix it.

If you don't want the the checkbox input to be nested inside the label set the option nestedInput to false when using FormHelper->input().

@gauravmak
Copy link
Author

Thanks man. perfect.
I meant to say the checkboxFormGroup options on the link should be updated not to include {{input}}, right?

checkboxWrapper doesn't seem to be anything. Is that so?

When we use Form->input, the div with the class input and input type (file, text, checkbox, etc.) is inevitable, correct? Need to go for specific type of option to avoid that top div? - http://book.cakephp.org/3.0/en/views/helpers/form.html#generating-specific-types-of-inputs

@ADmad
Copy link
Member

ADmad commented Apr 11, 2015

I meant to say the checkboxFormGroup options on the link should be updated not to include {{input}}, right?

I have fixed checkboxFormGroup template.

checkboxWrapper doesn't seem to be anything. Is that so?

By default it does a wrapper div.

Need to go for specific type of option to avoid that top div?

No, you can customize the inputContainer template using templates option for the Form->input() call and remove the wrapping div.

@ADmad ADmad closed this as completed Apr 11, 2015
@zkalinic
Copy link

It looks like FormHelper->input() or FormHelper->checkbox() are not using checkboxWrapper.
Is it implemented at all?

@markstory
Copy link
Member

@zkalinic It is in use see right here

@zkalinic
Copy link

Thanks markstory for pointing out where it is in use, but can you give me an example how to use it?

Just FormHelper->checkbox() or FormHelper->input(['type' => 'checkbox']) doesn't render checkboxWrapper...

@markstory
Copy link
Member

You need to be making a multipleCheckbox so Form->input('things', ['type' => 'checkbox', 'multiple' => true]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants