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>
);