Skip to content

Conversation

@jefft
Copy link
Contributor

@jefft jefft commented Oct 30, 2025

Successor to PR 1308 that got too messy..

Jethro has old-school error reporting: Javascript alerts:

image

For forms, it would be better to highlight the missing/incorrect form field value, with the error message below it.

This PR attempts to fix this. E.g. on /members login, rather than an alert:

image

Testing

Email

Email fields were not previously validated, because the code (in general.php) did not add a valid-email class, because (I think) it tries to handle text and email in one codepath.

Anyway, emails are now validated.

Screencast_20250917_205920.webm

Bible refs

E.g. at Services -> List All -> Edit Schedule

Screencast_20250917_210454.webm

Dates (day, year fields)

This shows how a single 'control group' can have two kinds of error message (for day and year):

Screencast_20250917_210606.webm

Phone numbers

Screencast_20250917_211703.webm

Also, phone numbers were previously only validated on submit, not on field blur.

Regex-validated inputs

E.g. a WWCC person field configured with regex:

image
Screencast_20250917_212855.webm

Note, HTML has its own regex input validation these days, via a pattern attribute. I used it too, just out of curiousity. It makes the text go red until the regex matches.

data-require-fields

Jethro has a data-require-fields attribute, which can be set on a submit button. It allows one to dynamically make an input required. Currently this is only used in person bulk actions.

Validation only takes place when the button is pressed:

Screencast_20250917_213601.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant