Fix HTML5 validation #308

Closed
wants to merge 2 commits into
from

4 participants

@mcuelenaere

This fixes HTML5 validation popups in browsers.
Instead of hiding the , move it under the container. This was briefly tested on Chrome, Firefox and Opera under Linux. Under Chrome, some tags seem to overlap for ~2px; I'm guessing calling .offset() to get the absolute position of the container isn't the correct way to do.

(this should fix #128)

mcuelenaere added some commits Aug 8, 2012
@mcuelenaere mcuelenaere Fix HTML5 validation
This fixes HTML5 validation popups in browsers.
Instead of hiding the <select>, move it under the container.
4c6f9e5
@mcuelenaere mcuelenaere Improved version, keep track of container position when resizing 3f9f686
@ivaynberg

shouldnt we still hide the original element? what happens if its larger then select2? i will poke from under.

@mcuelenaere

The problem with that, is that (at least on Chrome) this seems to excludes the element from displaying a popup and the user is just left in the dark as to why the form didn't submit (Firefox seems to have different behaviour with display:none and visibility:hidden).

The code sets the element's dimensions to the same as the ones from the container, but a "workaround" to the sticking out could be setting it to something like {width - 2px, height - 2px}.

@suslin

@ivaynberg what about this PR? It`s really big problem when trying to submit form with HTML5 validation and select field is required and empty. You can't understand what the problem, because bubble with error doesn't show.

@ivaynberg

the pull request does not provide a fully working solution and will cause problems for people who do not use html5 validation. once we have a way to do it that works correctly all the time i will apply it.

@jwmkrezmien

any news on this issue?

@ivaynberg

i havent found a good solution yet.

@ivaynberg

lets bring this into #128

@ivaynberg ivaynberg closed this Jan 31, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment