1
0
Fork 0

[DEV-3866] allow checkboxes to be unchecked

master
Joseph Frazer 2018-11-06 11:51:22 -05:00
parent 42a3432772
commit 85ac34ebbd
1 changed files with 9 additions and 1 deletions

View File

@ -349,15 +349,23 @@ module.exports = Class( 'GeneralStepUi' )
? +$element.attr( 'data-question-length' )
: 2;
var is_checked = $element.attr( 'checked' );
// if it's not checked and in a group, then this isn't
// the radio we're interested in. Sorry!
if ( !( $element.attr( 'checked' ) ) && group_length !== 1 )
if ( !is_checked && group_length !== 1 )
{
$element.attr( 'checked', true );
return;
}
// if this is a lonely checkbox, we only want the value if it is checked
if ( group_length === 1 && !is_checked )
{
val = 0;
}
index = Math.floor( index / group_length );
}