Skip to content

Prevent submit before validation complete#1113

Open
labkey-bpatel wants to merge 2 commits intorelease25.11-SNAPSHOTfrom
25.11_fb_submit_final_btn
Open

Prevent submit before validation complete#1113
labkey-bpatel wants to merge 2 commits intorelease25.11-SNAPSHOTfrom
25.11_fb_submit_final_btn

Conversation

@labkey-bpatel
Copy link
Copy Markdown
Contributor

@labkey-bpatel labkey-bpatel commented Apr 6, 2026

Rationale

https://github.com/LabKey/internal-issues/issues/828

Related Pull Requests

Changes

  • Disable submit buttons when validation is in progress.
  • Add a 'validation' indicator to show when validation in is progress (esp. useful when adding animals in Bulk).

@bbimber
Copy link
Copy Markdown
Collaborator

bbimber commented Apr 7, 2026

@brentlogan, i'm not sure what's driving this, but I dont think this is necessarily the behavior you want. In a perfect world, there would be minimal lag time between validation and submission. The challenge is that is someone is interacting with a form, there are lots of events that trigger many, many queries to the server to validate.

The reason we didnt introduce this kind of behavior originally is b/c the consequence of missing a validation should generally be negligible. If the user entered something and hit submit before the validation returned, then in theory the submit request should undergo the same checks and fail if there was a problem. There are definitely warnings and some fringe cases where this isnt quite true, but most of the time it should be.

@labkey-martyp
Copy link
Copy Markdown
Contributor

@brentlogan, i'm not sure what's driving this, but I dont think this is necessarily the behavior you want. In a perfect world, there would be minimal lag time between validation and submission. The challenge is that is someone is interacting with a form, there are lots of events that trigger many, many queries to the server to validate.

The reason we didnt introduce this kind of behavior originally is b/c the consequence of missing a validation should generally be negligible. If the user entered something and hit submit before the validation returned, then in theory the submit request should undergo the same checks and fail if there was a problem. There are definitely warnings and some fringe cases where this isnt quite true, but most of the time it should be.

@bbimber Agreed that in most cases the submit-time checks are a sufficient backstop, the problem is specifically with warnings, which are advisory and won't block a submit, so a missed warning silently produces subtler data issues rather than a clean failure. ONPRC has some form helpers for bulk entry where validation lag has been long enough that records are getting submitted before users ever see the warnings. Speeding up validation is worth pursuing too, but the validation paths continue to evolve, so it's hard to rely on perf alone. The plan is to keep the re-validate button enabled and show a "validating…" info message, so the user knows what's happening and can restart validation if a response is lost.

@bbimber
Copy link
Copy Markdown
Collaborator

bbimber commented Apr 7, 2026

@labkey-martyp, sure, I can see that. I did see the 'validating...' indicator which seems like a generally good idea.

my understanding of how this works is based purely off reading the code, so I might be partially wrong on what this does. However, if there are specific form helpers that trigger outsized problems (and the bulk entry ones probably are), could the code that does a bulk-add event simply add an explicit 'Loading..." popup that prevents user interaction until that first validation event completes? That would be in contrast to disabling a submit button in all cases, and better scope the change to the problematic situation. The title of this PR 'prevent submit until validation is complete' implies the impact is much more broad.

@labkey-martyp
Copy link
Copy Markdown
Contributor

labkey-martyp commented Apr 7, 2026

@bbimber this is intentionally broad because I think it's a good improvement for the EHR. There's continual development here with new form features and additional validation. Adding a loading modal on a per-feature basis seems like it could get missed and I doubt ONPRC will be the only to run into this. I assumed this was not done originally in these forms just because validation or bulk entry was not as extensive as they have become. Is the specific concern just that the UI will get stuck with missing validation responses?

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.

3 participants