Skip to content

isSubmitted check on forms without a name is broken #8

@rvanbaalen

Description

@rvanbaalen

When using a regular isSubmitted() check, it validates against a newly generated form name when no form name is specified.

Example form:

use ValidFormBuilder\ValidForm;
require '../vendor/autoload.php';

$objForm = new ValidForm();
//*** The area and select are not required to reproduce the issue.
$objArea = $objForm->addArea("Area label", true, "active-area", false);
$objAreaSelect = $objArea->addField("area-select", "Area select label", ValidForm::VFORM_SELECT_LIST,
    array(
        "required" => false
    )
);
$objAreaSelect->addField('value1','id1');
$objAreaSelect->addField('value2','id2');

//*** Generate form output
if ($objForm->isValid() && $objForm->isSubmitted()) {
    $strOutput = $objForm->valuesAsHtml();
} else {
    $strOutput = $objForm->toHtml();
}

Quick and easy but API breaking fix: make form name required. What do you think @flangfeldt? Can we make the form's name required?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions