Skip to content

Conversation

@moioo
Copy link

@moioo moioo commented Apr 14, 2015

<input type="checkbox" name="ids[]"  id="ids_1" value="1" required="true" minlength=1>
<input type="checkbox" name="ids[]"  id="ids_2" value="2" required="true" minlength=1>

valid runtime error: Error: Syntax error, unrecognized expression: #ids[]-error

The cause of the error elements ID name has invalid characters

        showLabel: function( element, message ) {
            var place, group, errorID,
                error = this.errorsFor( element ),
                elementID = this.idOrName( element ),
                describedBy = $( element ).attr( "aria-describedby" );
            if ( error.length ) {
                // refresh error/success class
                error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
                // replace message on existing label
                error.html( message );
            } else {
                // create error element
                error = $( "<" + this.settings.errorElement + ">" )
                    .attr( "id", elementID + "-error" )
                    .addClass( this.settings.errorClass )
                    .html( message || "" );

see #1457

@staabm
Copy link
Member

staabm commented Apr 14, 2015

Could you please fix the CS issues and add a unit test?

@jzaefferer
Copy link
Collaborator

The fix doesn't make sense (you need to escape, not replace with a dash), and the test doesn't work (it passes without the "fix").

@staabm
Copy link
Member

staabm commented Oct 19, 2015

Fixed with #1614

@staabm staabm closed this Oct 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants