Closed Patabugen closed 9 years ago
Hi. The purpose of all containers (not only groups, but also choose, collection, etc) is to provide a data structure, not a visual decoration structure. Maybe a way to group the form elements in groups for visual purposes can be fine (I'm thinking in a Fieldset object, for example) but right now, this feature is not available and the only way to customize the html code is using custom renders.
Hey Oscar,
I've created pull request with a simple mechanism for achieving the above request, which I feel is quite intuitive (append the parent name if one is given).
Hi, thanks for this contribution but I think you're focusing the problem in a wrong way. Group, Choose, Collection, etc should keep as is (ok, the problem with empty keys is a bug that should be fixed).But they have to manage the data structure, not the html structure. I think a better aproach to solve this is something similar to <select>
and <optgroup>
elements:
$select = F::select([
'one' => 'One',
'two' => 'Two'
]);
//the options are children of the select
$select['one']; //returns an Option instance
//Add a opgroup with one option
$select->optgroups([
'Opgroup label' => [
'three' => 'Three'
]
]);
//The option is child of select:
$select['three']; //returns the Option instance
This allows organize the options of the select without affect to the data structure. I'm thinking in something similar for the fieldsets:
$form->fieldsets([
'fieldset legend' => [
'name' => F::text(),
'password' => F::password()
]
]);
$form['name']; //returns the Text instance
//print the form using the fieldsets
foreach ($form->fieldsets() as $fieldset) {
echo $fieldset;
}
Hi. I've released the 4.5.0 version that brings support for fieldsets. I think this cover your request.
:)
Oh super, I'll take a look! Thanks!
Sami On 16/06/2015 17:31:33, Oscar Otero notifications@github.com wrote: Hi. I've released the 4.5.0 version [https://github.com/oscarotero/form-manager/releases/tag/v4.5.0] that brings support for fieldsets. I think this cover your request. :) — Reply to this email directly or view it on GitHub [https://github.com/oscarotero/form-manager/issues/56#issuecomment-112489417].
Hey,
I'd like to be able to add FormGroups but have the FormManager not put fields in those groups into arrays.
For example:
I'm trying to use groups for visual separating decoration and I'm adding a $fieldContainer->render() function to do that.
Perhaps a fix would be to not group the field names if the keys are numeric, and not defined?