Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

[Delivers #98157690] add client-side form validation #658

Merged
merged 18 commits into from
Oct 27, 2015

Conversation

afeld
Copy link
Contributor

@afeld afeld commented Oct 4, 2015

Depends/builds on #656. The diff:

96851664-simplify-forms...98157690-client-side-validation

Changes

  • Enables automatic HTML5 form validation via Simple Form
  • Includes a refactoring of the client-side form filtering code
  • disables the form fields that are hidden by the filter, so that they:
    • Don't get submitted with the form, e.g. sending the recurring_interval value when recurring isn't checked
    • Don't trigger client-side validation warnings
  • Set up JS testing using Konacha
  • Add tests around the filtering

Yay for limited-internet time to work on this! 🚂

Testing notes

  • Ensure that client-side validation works (or at least doesn't break the form) for the normal fields (ideally, in multiple browsers)
  • Ensure that empty required hidden fields (e.g. the BA80 fields when BA61 is selected) don't block submissions of the form
  • Ensure that values from hidden fields aren't getting sent to the server
  • Ensure that Selectize-d fields (the ones with the fancy dropdowns) aren't broken

@jessieay
Copy link
Contributor

jessieay commented Oct 5, 2015

Will review after #656 is finished/merged since it seems like there is a good amount of overlap

@afeld
Copy link
Contributor Author

afeld commented Oct 20, 2015

Ready for some 👀 !

@@ -53,6 +53,7 @@ gem 'workflow'
group :test, :development do
gem 'bullet', require: false # use BULLET_ENABLED=true
gem 'database_cleaner'
gem 'konacha'
Copy link
Contributor

Choose a reason for hiding this comment

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

niiiice

@afeld
Copy link
Contributor Author

afeld commented Oct 20, 2015

Updated!

@afeld afeld removed their assignment Oct 20, 2015
@pkarman pkarman self-assigned this Oct 21, 2015
@pkarman
Copy link
Contributor

pkarman commented Oct 21, 2015

I will QA

@pkarman
Copy link
Contributor

pkarman commented Oct 21, 2015

In general this looks good and doesn't seem to introduce any regressions.

There are some bugs though. Notably, an empty "Approver" field does not seem to trigger the "required" check. At first glance this seems to be because the HAML markup for that particular field is different than the others.

Likewise, empty "Building Code" and "Vendor" dropdown fields are not caught as required either.

Server-side validation still works as expected, though, so this might be acceptable in this first pass.
I'd be willing to merge this as a baseline implementation, and then open some bug stories to describe the missing pieces. Or, I can reject the existing story and you can give it another pass. Up to you @afeld.

@pkarman pkarman assigned afeld and unassigned pkarman Oct 21, 2015
@afeld afeld force-pushed the 98157690-client-side-validation branch from c4c7a15 to 3b8b95a Compare October 27, 2015 16:27
@afeld
Copy link
Contributor Author

afeld commented Oct 27, 2015

Yeah, unfortunately client-side validation doesn't work with Selectize fields (selectize/selectize.js#733). Client-side validation is a convenience, so I personally don't think it's a blocker if it doesn't work across every field.

@afeld afeld removed their assignment Oct 27, 2015
@afeld afeld removed the question label Oct 27, 2015
pkarman added a commit that referenced this pull request Oct 27, 2015
[Delivers #98157690] add client-side form validation
@pkarman pkarman merged commit 62d16bd into master Oct 27, 2015
@pkarman pkarman deleted the 98157690-client-side-validation branch October 27, 2015 20:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants