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

Show validation errors to user when creating a new form #1308

Merged
merged 2 commits into from Jun 9, 2019

Conversation

Projects
None yet
2 participants
@okahilak
Copy link
Collaborator

commented May 31, 2019

closes #1292

@okahilak okahilak force-pushed the show-form-validation-errors-to-user branch from dd1897f to c647994 Jun 3, 2019

@@ -27,20 +28,32 @@
(map key-to-id)
(str/join "-")))

(defn- get-error [context keys]
(when (:get-form-errors context)
(let [form-errors @(rf/subscribe [(:get-form-errors context)])]

This comment has been minimized.

Copy link
@Macroz

Macroz Jun 4, 2019

Collaborator

I would prefer that the component contains the subscription and not a random function that gets called. You could give the form-errors as parameters into this fn. In this case the subscription is duplicated into the call sites but at least it's more obvious that the component requires data.

This comment has been minimized.

Copy link
@okahilak

okahilak Jun 5, 2019

Author Collaborator

Done


(fn [{:keys [db]} [_ request]]
(let [form-errors (validate-form (db ::form) (db :languages))]
(when (nil-vals? form-errors)

This comment has been minimized.

Copy link
@Macroz

Macroz Jun 4, 2019

Collaborator

I would try to restructure the data so that this condition can be a plain empty?

This comment has been minimized.

Copy link
@okahilak

okahilak Jun 5, 2019

Author Collaborator

Done, good suggestion, I think it's better now

Show resolved Hide resolved src/cljs/rems/administration/create_form.cljs Outdated

@okahilak okahilak requested a review from Macroz Jun 6, 2019

@Macroz

Macroz approved these changes Jun 9, 2019

@Macroz Macroz merged commit 0abcce0 into master Jun 9, 2019

7 checks passed

WIP Ready for review
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: doo Your tests passed on CircleCI!
Details
ci/circleci: ok Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
ci/circleci: war Your tests passed on CircleCI!
Details
ci/circleci: without-db Your tests passed on CircleCI!
Details

@Macroz Macroz deleted the show-form-validation-errors-to-user branch Jun 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.