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

Add dynamic options to pd_form #17226

Merged
merged 2 commits into from Aug 23, 2017
Merged

Add dynamic options to pd_form #17226

merged 2 commits into from Aug 23, 2017

Conversation

aoby
Copy link
Contributor

@aoby aoby commented Aug 23, 2017

No description provided.

Copy link
Contributor

@Hamms Hamms left a comment

Choose a reason for hiding this comment

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

This looks great!

It would be nice to note somewhere that the class options will be supplied to the client via the controller so it can use them for rendering, but the dynamic options are for validation only.

@@ -39,7 +44,7 @@ def validate_required_fields
# empty fields may come about when the user selects then unselects an
# option. They should be treated as if they do not exist
hash.delete_if do |_, value|
value.empty?
value.blank?
Copy link
Contributor

Choose a reason for hiding this comment

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

why this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I encountered an error at some point during development because I had a nil (rather than empty) value. I don't remember how I got there, but blank? covers nil and empty?.

Is there a reason we'd want to preserve nil values?

Copy link
Contributor

Choose a reason for hiding this comment

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

ooooh right, nil. Good call

@aoby
Copy link
Contributor Author

aoby commented Aug 23, 2017

Good suggestion. I'll add a comment

@aoby aoby merged commit 7036c4f into staging Aug 23, 2017
@aoby aoby deleted the pd-form-dynamic-options branch August 23, 2017 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants