Skip to content

Other Validation Parameters

FieldRequired?PurposeNotes
rule_nameYes (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.
rulesOptional (array)List of rule strings from the table above.Can be empty if you only need presence checks; omit entirely to skip enforcement.
requiredOptional (defaults to false)Marks the field as mandatory; group validation fails until it’s valid.If omitted, the field is treated as optional.
show_errorOptionalWhen 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_okOptionalDisplays the “valid” icon when true.Mutually exclusive UX with show_error.
error_header / error_textOptionalText 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.
validOptional (framework managed)Tracks whether current value passes validation.Initial value can be false; framework updates it automatically.
<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_name is 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:true ensures 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.