Other Validation Parameters
Other data-validate properties
Section titled “Other data-validate properties”| Field | Required? | Purpose | Notes |
|---|---|---|---|
rule_name | Yes (for grouped validation) | Logical group name tying inputs/dropdowns to a button (via the button’s data-validate). | Use any consistent string. Without it, validateByRule cannot find siblings or toggle buttons. |
rules | Optional (array) | List of rule strings from the table above. | Can be empty if you only need presence checks; omit entirely to skip enforcement. |
required | Optional (defaults to false) | Marks the field as mandatory; group validation fails until it’s valid. | If omitted, the field is treated as optional. |
show_error | Optional | When true, error icon/message for this input is displayed when invalid. | Depends on page markup; set to false if you don’t need inline feedback. |
show_ok | Optional | Displays the “valid” icon when true. | Mutually exclusive UX with show_error. |
error_header / error_text | Optional | Text used when the framework shows an alert for failing required fields (e.g., when a disabled button is pressed). | Provide meaningful strings if required: true; otherwise alerts fall back to defaults. |
valid | Optional (framework managed) | Tracks whether current value passes validation. | Initial value can be false; framework updates it automatically. |
Minimum viable configuration
Section titled “Minimum viable configuration”<input id="input_name" data-validate='{ "rule_name":"profileForm", "rules":["minLength:1"], "required":true, "valid":false }'/>
<button id="button_save_profile" class="ankur_disabled ankur_btn_1" data-validate="profileForm"> Save</button>rule_nameis essential so the framework links inputs to the button.- Include at least one rule or leave the array empty if you only need “must not be blank”;
required:trueensures the button stays disabled until the field is non-empty and validated. show_error,show_ok, and custom messages are optional niceties you can omit for simpler pages.