Skip to content

Commit

Permalink
Merge pull request #63 from mcode/571-required-fields-fixes
Browse files Browse the repository at this point in the history
Fix issues with checking required fields
  • Loading branch information
plarocque4 authored Dec 13, 2023
2 parents 67c7acb + e76c973 commit 79c92a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/views/Questionnaire/QuestionnaireForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export function QuestionnaireForm(props: QuestionnaireProps) {
loadAndMergeForms(savedResponse);
const formErrors = LForms.Util.checkValidity();
setFormValidationErrors(formErrors == null ? [] : formErrors);
document.addEventListener('change', event => {

document.addEventListener('click', event => {
if (
props.filterChecked &&
event.target instanceof Element &&
Expand Down
4 changes: 3 additions & 1 deletion src/views/Questionnaire/SmartApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,9 @@ export function SmartApp(props: SmartAppProps) {
const updateRequired = (defaultFilter: boolean) => {
let checked: boolean, requiredCheckbox: HTMLInputElement;
if (!defaultFilter) {
requiredCheckbox = document.getElementById('required-fields-checkbox') as HTMLInputElement;
const requiredCheckbox = document.getElementById(
questionnaire ? `required-fields-checkbox-${questionnaire.id}` : 'required-fields-checkbox'
) as HTMLInputElement;
checked = requiredCheckbox ? requiredCheckbox.checked : false;
} else {
checked = true;
Expand Down

0 comments on commit 79c92a0

Please sign in to comment.