Issue Bug Closed

#93527Assigned form-object does not overwrite default-values

David Henninger 02/17/21, 10:08 updated 10/19/23, 09:56

Description

In the documentation of input viewhelpers of a form, it states “If used in conjunction with <f:form object="…">, ‘name’ and ‘value’ properties will be ignored.“<br>However only the name property is getting ignored. The (default) value attribute overwrites whatever the assigned object contains.</f:form>

Testcase:

<f:form name="object" object="{object}">
    With default value: <f:form.textfield type="text" property="withDefaultValue" value="Defaultvalue"/><br/>
    Only default value: <f:form.textfield type="text" property="onlyDefaultValue" value="Defaultvalue"/><br/>
    No default value:   <f:form.textfield type="text" property="noDefaultValue" /><br/>
</f:form>
public function showAction() {
    $this->view->assign('object', [
        "withDefaultValue" => "Value from object",
        "noDefaultValue"   => "Value from object",
    ]);
}

Expected result:
clipboard-202102171102-vucti.png

Actual result:
clipboard-202102171102-ghlih.png

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.