updated README.md with dependant field information

This commit is contained in:
2025-04-12 01:11:01 -04:00
parent 5f9ab78353
commit 19d97f1190

View File

@ -413,6 +413,7 @@ or [`input`](https://developer.mozilla.org/en-US/docs/Web/API/Element/input_even
## Field Options
* [dependant](#dependant)
* [maxCount](#maxcount)
* [minCount](#mincount)
* [optional](#optional)
@ -435,6 +436,27 @@ properly formatted JSON object with the properties and values below.
</div>
```
### dependant
**Default:** `null`
Setting the `dependant` value of one field to another field's `name` attribute
value will disable the field when its dependant does not contain a value.
```html
<figure class="form-group">
<label for="dependant-parent">Dependant Parent</label>
<input id="dependant-parent" type="text" name="dependant_parent">
<figcaption>This field dynamically enables/disables the 'Dependant Child' field if it has a value.</figcaption>
</figure>
<figure class="form-group">
<label for="dependant-child">Dependant Child</label>
<input data-validation='{"dependant": "dependant_parent"}' id="dependant-child" type="text" name="dependant_child">
<figcaption>This field dynamically enables/disables if the 'Dependant Parent' field has a value.</figcaption>
</figure>
```
### maxCount (Checkboxes Only)
**Default:** `null`