MR Labs

Validation & Config

Validation rules and visual config options for each field type.

Data Object Structure

The data parameter on add_field and update_field is a JSON object:

KeyTypeDescription
requiredbooleanWhether the field is required
optionsarrayRequired for select, radio, checkbox. Array of {label, value}
validationobjectValidation rules specific to the field type
configobjectVisual and behavioral configuration

Validation Rules by Type

text
KeyTypeDescription
prefixstringMust start with
suffixstringMust end with
containsstringMust contain
notContainsstringMust not contain
minnumberMin length
maxnumberMax length
patternregexRegex pattern
customMessagestringError message
textarea
KeyTypeDescription
minnumberMin length
maxnumberMax length
customMessagestringError message
email
KeyTypeDescription
customMessagestringError message
number
KeyTypeDescription
minnumberMin value
maxnumberMax value
customMessagestringError message
phone
KeyTypeDescription
customMessagestringError message
url
KeyTypeDescription
customMessagestringError message
date
KeyTypeDescription
minDateYYYY-MM-DDEarliest date
maxDateYYYY-MM-DDLatest date
allowedDatesstring[]Only these dates
disabledDatesstring[]Exclude these dates
customMessagestringError message
select
KeyTypeDescription
customMessagestringError message
radio
KeyTypeDescription
customMessagestringError message
checkbox
KeyTypeDescription
minnumberMin selections
maxnumberMax selections
customMessagestringError message
slider
KeyTypeDescription
minnumberMin value
maxnumberMax value
customMessagestringError message
file
KeyTypeDescription
allowedMimeTypesstring[]e.g. ["image/png", "application/pdf"]
customMessagestringError message

Config Options by Type

text, textarea, email, number, phone, url, select
KeyTypeDescription
variantenumdefault, boxed, minimal, floating
sizeenumsm, md, lg
helpTextstringHelp text below field
text, email, number, phone, url
KeyTypeDescription
iconenumuser, mail, phone, calendar, hash, dollar, star, heart, globe, search, clock
text
KeyTypeDescription
prefixstringPrefix inside input
suffixstringSuffix inside input
radio, checkbox
KeyTypeDescription
displayModeenumlist, grid, cards, images
columns1-4Columns for grid/cards/images
helpTextstringHelp text below field
date
KeyTypeDescription
sizeenumsm, md, lg
iconenumcalendar
helpTextstringHelp text below field
file
KeyTypeDescription
maxFileSizenumberMax size in bytes
helpTextstringHelp text below field
info
KeyTypeDescription
infoStyleenumflat, card, banner, callout, quote
calloutTypeenuminfo, tip, warning, success
image
KeyTypeDescription
urlstringImage URL
altstringAlt text
roundedenumnone, md, lg, xl
video
KeyTypeDescription
urlstringVideo URL
download
KeyTypeDescription
urlstringDownload URL
redirect
KeyTypeDescription
urlstringRedirect URL

Page Config

Pages support a config object via update_page:

KeyTypeDescription
showTitlebooleanShow or hide the page title in the form runner. Default: false.