-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Frontend does not ignore required
validations from backend
#1062
Comments
@RonnyB71 @olemartinorg I'd like to be able to resolve this mess with I currently see a few possible solutions:
|
I'd prefer number 2 as a temporary solution, but with that said, the whole validations system is due for an overhaul (and I think the plan is to start discussing solutions there very soon). I think it's better to look into the whole problem area instead of playing whack-a-mole with every bug in this category right now. |
Workaround has been manually tested and verified to work. 🥳 Thanks! |
I think it's time to close this one, and live with the workaround we already have. It is even less temporary now than it was back when we started talking about it as temporary.. 😉 As for the overhaul: Altinn/app-template-dotnet#180 |
Description of the bug
Apps that enable
"RemoveHiddenDataPreview"
gets the benefit of backend validation of components that are marked"required": true
(or an expression that evaluates to true). This is great because it ensures that users that open devtools, or deliver schema using the API, also is forced to answer all the required questions before submitting.A problem is that backend during validation does not know what language the user wants their messages, so it can't really say anything more than
required
and indicate the field and component that triggered the error. I suggest to improve it somewhat in Altinn/app-lib-dotnet#217, but as frontend already generates great warnings for empty required fields, the result will always be a duplicated validation message. I think the best solution is to just ignore any validation error with"code": "required"
so that frontend can handle required independent of backend. (there probably need to be some way to show the error in case frontend thinks the instance is OK, but backend still thinks required values are missing).Steps To Reproduce
"RemoveHiddenDataPreview"
"required"
to the schemaTODO required
Additional Information
No response
The text was updated successfully, but these errors were encountered: