jazzband / django-floppyforms

Full control of form rendering in the templates.
http://django-floppyforms.readthedocs.org/
Other
841 stars 148 forks source link

required map UI issue #176

Closed tisdall closed 8 years ago

tisdall commented 8 years ago

In a form with a PointField widget (it probably does the same for any map widget) the UI in Chrome is less than ideal. The issue is that all the data is encoded and placed in a hidden textarea that's marked as required (the html5 attribute). If a person leaves the field empty and hits "Submit" then you get an error message in the console saying "An invalid form control with name='loc' is not focusable." (where 'loc' is the name of the textarea) and the form simply doesn't submit. This should probably be changed so required is left off of the hidden textarea regardless and the missing data is caught afterwards in Django validation.

This seems to be easily fixed by changing: {% include "floppyforms/textarea.html" %} to: {% include "floppyforms/textarea.html" with required=False %} in the openlayers.html file.

tisdall commented 8 years ago

False as a template variable was added in 1.5, though, so maybe 0 instead.

gregmuellegger commented 8 years ago

For the moment you can disable HTML5 validation on the form with <form ... novalidate>.

Or you can use the current master, I just pushed a commit including the required=0 as you suggested. :)

Thanks for the report!