You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think we have a place in AMY where we do "soft validation". Here are my three ideas how to implement it. It's definitely not easy.
Idea 1: code validation as background process in the browser
Once the code is filled out by the user, we'd make a request to the API to see if there's a membership matching criteria.
With JS we'd dynamically show warnings in the form for the user, based on the responses from the server.
This potentially exposes the API to third parties as users don't have to be logged in in these forms, so some throttling should be implemented.
Idea 2: dynamic field requesting user to confirm the message popup
After user provides the code and there's something wrong with it, we amend the form by adding a new required checkbox field next to that member code.
This is clever because it uses Django default behavior to "break" form validation, but at the same time it's easy for the user to correct the form without changing member code - thus soft validation.
The downside is that altering a form like that is not an easy task.
Idea 3: remembering form state between requests
This idea uses Django session storage to remember if user say the warning message.
When first attempt on validating the form throws the error like in your current implementation, the server should also store some variable in the session.
This variable, when present in the session, would then change the member code validation and prevent throwing the same error twice. Finally the variable should be removed from the server session.
Note from @elichad :
Final decisions about the member codes validation are yet to be made, so we could also decide not to implement soft validation at all.
The text was updated successfully, but these errors were encountered:
Originally posted by @pbanaszkiewicz in #2532 (comment)
I don't think we have a place in AMY where we do "soft validation". Here are my three ideas how to implement it. It's definitely not easy.
Idea 1: code validation as background process in the browser
Once the code is filled out by the user, we'd make a request to the API to see if there's a membership matching criteria.
With JS we'd dynamically show warnings in the form for the user, based on the responses from the server.
This potentially exposes the API to third parties as users don't have to be logged in in these forms, so some throttling should be implemented.
Idea 2: dynamic field requesting user to confirm the message popup
After user provides the code and there's something wrong with it, we amend the form by adding a new required checkbox field next to that member code.
This is clever because it uses Django default behavior to "break" form validation, but at the same time it's easy for the user to correct the form without changing member code - thus soft validation.
The downside is that altering a form like that is not an easy task.
Idea 3: remembering form state between requests
This idea uses Django session storage to remember if user say the warning message.
When first attempt on validating the form throws the error like in your current implementation, the server should also store some variable in the session.
This variable, when present in the session, would then change the member code validation and prevent throwing the same error twice. Finally the variable should be removed from the server session.
Originally posted by @pbanaszkiewicz in #2532 (comment)
Note from @elichad :
Final decisions about the member codes validation are yet to be made, so we could also decide not to implement soft validation at all.
The text was updated successfully, but these errors were encountered: