CDRH / orchid

Rails Engine for site integration with CDRH API
MIT License
3 stars 0 forks source link

entering incorrect date causes search to fail #158

Open jduss4 opened 5 years ago

jduss4 commented 5 years ago

If you enter, say, "1958-13-11" into the search instead of "1958-11-13" because you're not very good with dates, you will get a big ole err saying that there is no @res object for things like @res.count to use. Looks like this is because the API is unhappy about the date format (makes sense), so it's returning 500 and then orchid isn't handling it gracefully.

Think about how we might want to modify this behavior, if we want a front-end checker in the UI to refuse to send a request if it doesn't have a valid date, etc.

techgique commented 5 years ago

Handling things like this on the back end is preferred priority. I was recently looking at the code that handles removing params etc and I believe the request sent to the API for the date filter has its own method called from the controller.

We might be able to just modify the number down to 12 if it is larger than that. And possibly display a flash message indicating that was done?

As for client-side validation, I think there are built-in markup validation abilities that don't require adding custom JavaScript. Progressive enhancement. Nice browsers get it, lame ones won't.

techgique commented 5 years ago

Server-side validation handled, but we should switch the inputs to <input type="date"> and update associated code for client-side UI and validation

karindalziel commented 2 years ago

Verify that this is mostly handled, but we don't need to include in this release.