ReadonlycontextReadonlyenableTargets will be enabled if the target's rule matches the scoped form data, otherwise will be disabled.
ReadonlyhasTrue if there is at least one enable target, used to ensure rules do not run if not needed.
ReadonlyhasTrue if there is at least one show target, used to ensure rules do not run if not needed.
ReadonlyshowTargets will be shown if the target's rule matches the scoped form data, otherwise will be hidden with the hidden attribute.
StaticblessingsStaticoutletsStatictargetsStaticvaluesStaticshouldFinds & parses the rules for the provided target by the rules attribute,
which is determined via the identifier and the provided effect name,
(e.g. data-w-rules-enable). Falling back to the generic attribute
if not found (e.g. data-w-rules).
With the found rules, check the rules cache first, then parse the rules for caching if not found.
When parsing the rule, assume an Object.entries format or convert an
object to this format. Then ensure each value is an array of strings
for consistent comparison to FormData values.
Support an override of the match value, via a rule entry with a string that
is an empty string, as this will not be a valid field name.
Resolve the conditional targets based on the form data and the target(s) rule attributes and the controlled element's form data.
Staticafter
Adds the ability for a controlled form element to conditionally enable or show targeted elements based on the data from the controlled form along with a set of rules to match against that data.
Example: - Enable a button if a specific value is chosen
Example: - Show an additional field when a select field value is chosen