Permalink
Browse files

Checkboxradio: Retrieve form ID via .getAttribute()

Closes gh-7224
Fixes gh-7223
  • Loading branch information...
1 parent a9d37be commit 9ff610de479097c85ec7289e67fc656e5581d817 @gabrielschulhof gabrielschulhof committed Mar 9, 2014
Showing with 9 additions and 1 deletion.
  1. +1 −1 js/widgets/forms/checkboxradio.js
  2. +8 −0 tests/unit/checkboxradio/input-set-tests.html
@@ -196,7 +196,7 @@ $.widget( "mobile.checkboxradio", $.extend( {
// If we're inside a form
if ( form ) {
- formId = form.id;
+ formId = form.getAttribute( "id" );
// If the form has an ID, collect radios scattered throught the document which
// nevertheless are part of the form by way of the value of their form attribute
@@ -32,6 +32,14 @@
<div data-nstest-role="page">
<label>Radio<input id="radio:1" type="radio" name="group1"></label>
<form id="the-[form]">
+ <!--
+ https://github.com/jquery/jquery-mobile/issues/7223
+ Adding the below hidden input will cause code that accesses the form attribute via
+ form.id to return this input, rather than the ID of the form. The presence of this
+ input constitutes a test against that kind of code. The correct way to retrieve the
+ id of a form is form.getAttribute( "id" ).
+ -->
+ <input type="hidden" name="id" value="">
<label>Radio<input id="radio:2" type="radio" name="group1"></label>
<label>Radio<input id="radio:7" type="radio" name="group1" form="the-'other'-form"></label>
</form>

0 comments on commit 9ff610d

Please sign in to comment.