Let the event form submit and say what is wrong #177
No reviewers
Labels
No labels
app:activities
app:chat
app:chatelet
app:events
app:forum
app:libra
app:market
app:restaurant
app:tasks
app:wallet
app:webapp
bug
enhancement
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
aiolabs/webapp!177
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/submit-gate-explains-itself"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found on demo while testing #176: a fully filled event form — title, dates, price, capacity, payment methods, a promo code and three named ticket waves — with the Submit button greyed out and nothing on screen explaining why.
It isn't the wave validation
First thing I checked, since #176 added a wave gate. It isn't: running the exact form contents through the validators gives
WAVE ERRORS: {}andPROMO ERRORS: [{}]. The blocker was vee-validate'smeta.valid, which predates that PR.Gating on
meta.validis the actual bugIt's a known foot-gun, and this dialog hits every part of it:
disabledwas removed from<Field>because consistent behaviour was unachievable. This dialog disables inputs while loading and rendersfiat_currencyconditionally.meta.validstaying false with zero errors after a form is re-shown.valid && dirtyrather thanvalid.A flag that's unreliable in both directions shouldn't be the only thing between an organiser and their event — especially as a disabled button, which is an unrecoverable dead end with no affordance for finding out why.
What changes
The button is disabled only while a submit is genuinely in flight. The reasons now come to the user:
handleSubmit's invalid callback names the offending fields in a toast, opens whichever collapsible holds one, and scrolls the first into view. Previously aFormMessageinside a closed section was invisible — andnotification_subjectisn't rendered at all, so its error could never have been seen.Verified in a browser
A blank form has a live button, and clicking it reports exactly what's missing. 72 tests pass,
vue-tscclean, prettier clean, production build succeeds.Note for whoever is blocked right now
Until this deploys, the offending field is still discoverable —
FormControlsetsaria-invalid, so this in the console names it:Sources: Handling Forms · #4630 · #1109
The Submit button was disabled on `meta.valid`, so an organiser with a fully filled form could be left staring at a dead button with nothing on screen explaining it. Reported from demo: title, dates, price, capacity, payment methods and three named ticket waves all filled, no error text anywhere, submit greyed. Gating on `meta.valid` is a known vee-validate foot-gun: - disabled fields count against form validity, and the maintainer removed `disabled` from `<Field>` precisely because consistent behaviour was unachievable. This dialog disables inputs while loading and renders `fiat_currency` conditionally, so it is exposed. - `meta.valid` is documented to go stale — false with zero errors after a form is re-shown (logaretm/vee-validate#4630). - it is false before the form has ever validated, which is why the docs suggest `valid && dirty` rather than `valid` alone. A flag that is unreliable in both directions should not be the only thing between an organiser and their event. So the button is now disabled only while a submit is genuinely in flight, and the reasons come to the user instead: - `handleSubmit`'s invalid callback names the offending fields in a toast ("Check Tickets, Start date, Title"), opens whichever collapsible holds one, and scrolls the first into view. Previously a FormMessage inside a closed section was invisible. - promo codes and ticket waves are not in the Zod schema, so vee-validate cannot block on them; they are checked in the submit handler, which opens their section rather than failing silently. Both editors live inside collapsibles, so this was the same trap. Verified in a browser: a blank form now has an enabled button, and clicking it reports "Check Tickets, Start date, Title". Refs aiolabs/events ticket-wave work; the report came from testing #176 on demo.meta.valid, which can be false with zero errors #178