Open Panchiwalayash opened 2 days ago
Perhaps I am not understanding your requirement.
In QtiSimpleChoice there are 'click' and 'keydown' event handlers which trigger 'setChecked' events on the parent component (ChoiceGroup). Example:
handleClick () {
if (this.isDisabled) return
if (this.isRadio) {
this.$parent.$emit('setChecked', { 'identifier': this.identifier, 'checked': 'true' })
} else {
this.toggleChecked()
this.$parent.$emit('setChecked', { 'identifier': this.identifier, 'checked': this.checked })
}
}
The $parent in this case is ChoiceGroup. And in QtiChoiceInteraction we can see that ChoiceGroup has an event handler for @setChecked
<ChoiceGroup
ref="choicegroup"
:cardinality="cardinality"
:shuffle="shuffle"
:responseIdentifier="responseIdentifier"
:maxChoices="maxChoices"
:minChoices="minChoices"
@choiceGroupReady="handleChoiceGroupReady"
@setChecked="handleSetChecked"
@setFocusNextChoice="handleSetFocusNextChoice"
@setFocusPreviousChoice="handleSetFocusPreviousChoice"
@setActiveDescendant="handleSetActiveDescendant"
v-bind="$attrs">
<slot name="default" />
</ChoiceGroup>
In turn, 'handleSetChecked' receives the 'setChecked' event from the inner QtiSimpleChoice component before updating the interaction's response, validity, and state. From what I can interpret from the issue, 'handleSetChecked' in QtiChoiceInteraction seems to be the event handler you might be looking for.
When selecting an option for questions in the application, I need the answer to be automatically checked. However, I am unable to find an event emitter that triggers when an option is changed, which is causing issues with automating the answer-checking process.