validate on page load? #85
Replies: 2 comments 2 replies
-
I don't think there's currently an exposed API that would let you do this. It would be possible if we add a I've also been thinking about adding a |
Beta Was this translation helpful? Give feedback.
-
Following up on this. In a recent release, I added a I do want to caution against this pattern though. Having errors displayed on the form before the user has typed anything isn't a good feeling. And disabling the submit button when there are no visible errors can cause confusion and frustration -- the user might know that something is wrong with the form, but they have no idea what. Or maybe they just think your site is broken. Also worth noting that disabling the submit button when the form is invalid also causes issues with users that have JS disabled. If the form submits and the action returns errors, the form will render with the submit button disabled unless you're explicitly checking that JS is enabled. This may not be important to your app/site, but it's good to know if it is. My general recommendation is to leave the submit button enabled all the time. This has a couple UX advantages:
|
Beta Was this translation helpful? Give feedback.
-
Hi, i want to ask, if there is a way to validate the form after page load, so the submit button is disabled by default? I think this is a better UX, because on an empty form, users shouln't have the possibility to click the submit button.
Beta Was this translation helpful? Give feedback.
All reactions