1
0
Fork 0

[DEV-3866] changes for new checkbox question type

The new checkbox question type is setup with an empty validator. When
checked, it was not unchecking because it was trying to behave like the
"noyes" questions. I updated the logic to not behave like that if there
is only one checkbox in a group.
master
Joseph Frazer 2018-11-01 16:51:50 -04:00
parent 2df1ecc426
commit a8d0b8c817
2 changed files with 12 additions and 10 deletions

View File

@ -1,7 +1,7 @@
/**
* General UI logic for steps
*
* Copyright (C) 2015 R-T Specialty, LLC.
* Copyright (C) 2015, 2018 R-T Specialty, LLC.
*
* This file is part of liza.
*
@ -343,20 +343,21 @@ module.exports = Class( 'GeneralStepUi' )
|| $element.attr( 'type' ) === 'checkbox'
)
{
// if it's not checked, then this isn't the radio we're
// interested in. Sorry!
if ( !( $element.attr( 'checked' ) ) )
// 2 in this instance is the yes/no group length.
var group_length = $element.attr( 'data-question-length' )
? +$element.attr( 'data-question-length' )
: 2;
// 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 )
{
$element.attr( 'checked', true );
return;
}
// 2 in this instance is the yes/no group length.
var group_length = $element.attr( 'data-question-length' )
? $element.attr( 'data-question-length' )
: 2;
index = Math.floor( index / group_length );
}

View File

@ -1,7 +1,7 @@
/**
* Standard formatters
*
* Copyright (C) 2017 R-T Specialty, LLC.
* Copyright (C) 2017, 2018 R-T Specialty, LLC.
*
* This file is part of the Liza Data Collection Framework.
*
@ -81,6 +81,7 @@ module.exports = function( type_map )
explain: formatter.VoidFormatter,
dateTime: formatter.VoidFormatter,
waitable: formatter.VoidFormatter,
checkbox: formatter.VoidFormatter,
/* TODO:*/
state: formatter.VoidFormatter,