Skip to content
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

[Member codes] Implement soft validation for member codes #2535

Closed
elichad opened this issue Sep 19, 2023 · 0 comments · Fixed by #2549
Closed

[Member codes] Implement soft validation for member codes #2535

elichad opened this issue Sep 19, 2023 · 0 comments · Fixed by #2549
Assignees
Milestone

Comments

@elichad
Copy link
Contributor

elichad commented Sep 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

1 participant