[DEV-3866] checkboxes were not changing values when unchecked
If a single checkbox in a group is not checked, the value should be "0".master
commit
52285d0a6c
|
@ -349,15 +349,23 @@ module.exports = Class( 'GeneralStepUi' )
|
||||||
? +$element.attr( 'data-question-length' )
|
? +$element.attr( 'data-question-length' )
|
||||||
: 2;
|
: 2;
|
||||||
|
|
||||||
|
var is_checked = $element.attr( 'checked' );
|
||||||
|
|
||||||
// if it's not checked and in a group, then this isn't
|
// if it's not checked and in a group, then this isn't
|
||||||
// the radio we're interested in. Sorry!
|
// the radio we're interested in. Sorry!
|
||||||
if ( !( $element.attr( 'checked' ) ) && group_length !== 1 )
|
if ( !is_checked && group_length !== 1 )
|
||||||
{
|
{
|
||||||
$element.attr( 'checked', true );
|
$element.attr( 'checked', true );
|
||||||
|
|
||||||
return;
|
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 );
|
index = Math.floor( index / group_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue