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

webapps remove prevalidate #28694

Closed
wants to merge 2 commits into from
Closed

Conversation

knguyen142
Copy link
Contributor

@knguyen142 knguyen142 commented Oct 26, 2020

https://dimagi-dev.atlassian.net/browse/SAAS-11161

SUMMARY

Currently when we submit we send up only answers that are valid (do not have any errors) and if there are any invalid answers, we send up a prevalidated=false flag.

When formplayer receives the submission, it rejects if one of the 2:

  1. it's own validation check based on the answers submitted fail
  2. prevalidated=false is sent up

It seems like this has logic has been there since the beginning. This change does the following:

  1. Sends up all answers (including invalid/errored ones)
  2. sends up prevalidated=true (cannot remove this var yet, must remove from formplayer first)
FEATURE FLAG
RISK ASSESSMENT / QA PLAN
PRODUCT DESCRIPTION

This is deployed to staging and can be seen in this app.

required-conditions

Also ccing @ctsims in case he knows something about prevalidated.

@knguyen142 knguyen142 added the product/all-users-all-environments Change impacts all users on all environments label Oct 26, 2020
Copy link
Contributor

@orangejenny orangejenny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine. What do you think is the risk level of this PR?

@knguyen142
Copy link
Contributor Author

@orangejenny The only thing I can think of is if there is a UX/product case where the browser marks the question as invalid, but formplayer would accept it. The original implementation would fail while this change would make it pass.
Can you think of anything with that use case?
When I look at code, there's 2 types of error functions (error() and serverError()). I'll do a test later, but this is an example. I believe if the selection is not an option in the combobox entry it will have a browser error and send up prevalidate=false and it will fail. However, if we make prevalidate=true we have to make sure formplayer also knows that the selection is not valid.
I did a quick search of .error( and it occurs in some places for type validation, etc. I'm hoping that this is just a optimization that we do on the front end, and that we also do these same validations on server.

@orangejenny
Copy link
Contributor

@knguyen142 Cool, that all sounds good and logical to me, thanks for writing it out. My understanding is also that any client-side validation is just a convenience and is also done by formplayer.

@orangejenny
Copy link
Contributor

@knguyen142 I just realized #28701 should make that specific combobox error no longer an issue. The old widget allowed you to enter free text, but the new one does not.

@knguyen142
Copy link
Contributor Author

I'm going to close this for now to not add complexity to the system, but will reopen if it's needed in the future.

@knguyen142 knguyen142 closed this Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product/all-users-all-environments Change impacts all users on all environments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants