Skip to content

Visited is not propagated from ValidationGroup to the TextField properly, when visited is initialised #1276

@ognjenst

Description

@ognjenst

In the form, if we initialize the visited bind to false, and later change its value to true, this information is not propagated from the ValidationGroup to the TextField. But if we skip the initialization, it will work properly.

import { Button, HtmlElement, TextField, ValidationGroup } from "cx/widgets";
import { PureContainer } from "cx/ui";

export const App = (
  <cx>
    <PureContainer
      controller={{
        onInit() {
          // This is the issue. When this line does not exist, it works as expected.
          this.store.set("form.visited", false);
        },

        submit() {
          this.store.set("form.visited", true);
        }
      }}
    >
      <ValidationGroup valid-bind="form.valid" visited-bind="form.visited">
        <TextField required value-bind="value1" />
        <Button onClick="submit" />
      </ValidationGroup>
    </PureContainer>
  </cx>
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions