Skip to content

addGroup inconsistent behaviour #16

@MaybeFactor

Description

@MaybeFactor

Hi again,
When adding a group of elements, the behaviour of the addGroup method has some inconsistency in the resulting html element depending on whether or not a $name is specified. Basically, if a name is provided, the $appendName parameter is respected (defaulting to true), but if no name is specified, a name gets generated and $appendName is set to false. Having recently updated our code to flack/quickform from the old pear version, this is a difference in behaviour that makes updating more risky.

e.g.

$group[] = $form->createElement("text", "field");
$form->addGroup($group);

produces <input type="text" name="field" />, but

$group[] = $form->createElement("text", "field");
$form->addGroup($group, "group");

produces <input type="text" name="group[field]" />.

An easy fix is to change the default $appendName to false, so that the default behaviour is universally to not append the names. I'm happy to apply this change myself, but wanted to make sure other contributors were agreed that it's a good idea. Let me know if you think this is alright, and I'll go ahead with the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions