oscarotero / form-manager

PHP library to create and validate html forms
MIT License
153 stars 42 forks source link

Element Groups without Arrays #57

Closed Patabugen closed 9 years ago

Patabugen commented 9 years ago

I wanted to be able to have an Element Group which didn't affect the name attribute of it's children.

This example probably explains this better:

http://pata.cat/tools/form-manager/examples/index.php?example=groups-without-grouped-values

Currently the behaviour is that if the key in the array of children is falsy it won't:

$form->add([
    0 => $groupOne, // Won't affect name
    '' => $groupTwo, // Won't affect name
    '' => $groupThree // Will affect name
    'one' => $groupThree // Will affect name
]);

This was a little inconsistent, and tantalisingly close to allowing you to have groups which didn't affect the name.

This change adds the clause that if the key is an integer it won't affect the name - meaning if you don't specify a key name it won't alter it.

Patabugen commented 9 years ago

I seem to have included a couple of typo fixes in the Readme in this PR too! I can remove them if you like.

Patabugen commented 9 years ago

Hold the phone, I've just tested this with the form processing and there are issues. I'll investigate and post and update.