Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Optional ValidationGroup child-field setting override

See original GitHub issue

Currently, as of Cx v20.7.1 form fields can override the ValidationGroup settings, e.g. if a ValidationGroup is disabled, the same setting on a respective field, being more specific, overrides it (commit id: c2adf44c9de). In previous versions of Cx it was the other way around, ValidationGroup settings would take precedence over respective field settings within it.

Since both behaviors have valid use-cases, it would be good if the developer could decide which one is more appropriate, via a custom flag, e.g. overrideFieldSettings={true/false} or something in that sense.

The implementation could rely on the optional use of the coalesce function, based on the flag value.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

mstijakcommented, Aug 10, 2020

Strict mode would work in that way that if disabled is evaluated to true on ValidationGroup it would force all children to be disabled. If the value is false, fields can decide for themselves.

The opposite (more common) use-case is that in the non-strict mode the field should able to be enabled by setting disabled to false, ignoring the parent settings, i.e. if one field is an exception.

mstijakcommented, Aug 10, 2020

Published in cx@20.8.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can I override fields from a Pydantic parent model to make ...
Overriding fields is possible and easy. (Somebody mentioned it is not possible to override required fields to optional, but I do not agree)....
Read more >
Specifying Validation Groups - Microsoft Learn
You create a validation group by setting the ValidationGroup property to the same name (a string) for all the controls you want to...
Read more >
How to have an “optional” field but if present required ... - GitHub
One is to allow BaseModel 's to have a special configuration option that ... Like @acnebs, I don't override the whole object, I...
Read more >
5.5. Input Validation -
Override the message for age field using the below settings. # override messages NotNull.userForm.age="{0} ...
Read more >
Conditionally Requiring a Form Field in Symfony2
In this case, the state field isn't built initially: it waits until the form data is set and then is built based off...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found