Survey: prevent submission if incomplete
prevent exception when reloading viewer (primaryEntityRef was null)
export let primaryEntityRef;
- $: instanceCall = surveyInstanceViewStore.getInfoById(primaryEntityRef?.id);
- $: $surveyDetails = $instanceCall.data;
+ let instanceCall, formDetailsCall, responsesCall;
- $: formDetailsCall = surveyInstanceViewStore.getFormDetailsById(primaryEntityRef?.id);
- $: $formDetails = $formDetailsCall?.data;
+ $: {
+ if (primaryEntityRef) {
+ instanceCall = surveyInstanceViewStore.getInfoById(primaryEntityRef.id);
+ formDetailsCall = surveyInstanceViewStore.getFormDetailsById(primaryEntityRef.id);
+ responsesCall = surveyInstanceStore.findResponses(primaryEntityRef.id);
+ }
+ }
- $: responsesCall = surveyInstanceStore.findResponses(primaryEntityRef?.id);
+ $: $surveyDetails = $instanceCall?.data;
+ $: $formDetails = $formDetailsCall?.data;
$: $responses = $responsesCall?.data;
$: sectionsToShow = $selectedSection
{/each}
</div>
-
+ {#if primaryEntityRef}
<div class="col-sm-4"
style="padding-left: 0">
<SurveyViewerContextPanel on:select={onChangeInstance}
instanceId={primaryEntityRef.id}/>
</div>
+ {/if}
</div>
