furiouscollective / gridforms

Data entry can be beautiful
https://formkeep.com/gridforms
MIT License
2.39k stars 220 forks source link

Data-field with more than 1 select element #29

Closed globophobe closed 9 years ago

globophobe commented 9 years ago

Thanks for gridforms. It's really improved my forms. I had a problem with a data-field with more than 1 select element. Specifically, it was a date field, so "month", "day", "year" selects. From line 46 of gridforms.js

$(this).find('input[type="text"], textarea, select').focus();

Focus goes to the last element, which made the selects useless. My quick fix was to remove 'select' from the arguments.

Is there a better way?

benstroud commented 9 years ago

This issue affected me as well. I applied the fix suggested by @globophobe. Before patching, Chrome would not allow user to interact with any grouped select box except last.

kumailht commented 9 years ago

I could look into this when I get sometime but if either of you feel like contributing to GridForms, I'd encourage you to submit a pull request with a solution. I will always be around to help collaborate, test & merge it in.

globophobe commented 9 years ago

Thanks. I'm still working on integrating GridForms into my Django site. There are some other things that I'm interested in finding a nice solution for. For example, the height of the data cells needs to be recalculated if a form, with validation errors, is returned via ajax, after the page loads. But, the people who will use the site are very happy with the GridForms design. So, these are minor issues. I'd be happy to submit a pull request, after thinking about what is and isn't Django specific.

kumailht commented 9 years ago

I have never tried Gridforms with Django, although I have built many a Django forms. Did you face any problems rendering the form to template? Were you able to create a form loop or were you forced to render each field on its own?

globophobe commented 9 years ago

With loops. The basic implementation is https://gist.github.com/globophobe/f5b7fe869cc858f7e457 At first, I thought to do something with CrispyForms. But, this was simpler. The gist doesn't support inlines. The Django site supports them, though.

kumailht commented 9 years ago

Seems fairly complex but some complexity comes free with Django :) Also, Django's form templating is probably it's weakest component. So given that, it's pretty cool that you could render a grid form.

shayneoneill commented 4 years ago

Damn. Woulda been good to read that gist. Looks like gists deleted it :(