Skip to content

Setting a field required in the form not working. #2

@rajeev-k-tomy

Description

@rajeev-k-tomy

Problem

In my form layout xml file, I have this:

        <referenceContainer name="content">
            <block
                name="namespace_module.form"
                template="Loki_AdminComponents::form.phtml">
                <arguments>
                    <argument name="provider" xsi:type="string">Namespace\Module\Api\ContactPersonRepositoryInterface</argument>
                    <argument name="resource_model" xsi:type="string">Namespace\Module\Model\ResourceModel\ContactPerson</argument>
                    <argument name="factory" xsi:type="string">Namespace\Module\Model\ContactPersonFactory</argument>
                    <argument name="fields" xsi:type="array">
                        <item name="firstname" xsi:type="array">
                            <item name="required" xsi:type="boolean">true</item>
                        </item>

Here the field change set on the firstname field is not working. However visible will work without issues.


Technical details

Required method is present in the class \Loki\AdminComponents\Form\Field\Field::isRequired(). So it is not been used in the template file: view/adminhtml/templates/form/field.phtml and in the render phtml files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions