-
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate ODK Web Forms prototype with functioning form submissions #2074
Comments
How Web Forms Work CurrentlyAfter digging into getodk/web-forms, we can see that the For example (see the XForm XML is added as a prop): <OdkWebForm
:form-xml="formPreviewState.formXML"
:fetch-form-attachment="formPreviewState.fetchFormAttachment"
:missing-resource-behavior="formPreviewState.missingResourceBehavior"
@submit="handleSubmit"
/> The OdkWebForm component has three main parts: header, QuestionList, submit button. QuestionList is where the actual questions are rendered: <template v-for="node in nodes" :key="node.nodeId">
<template v-if="node.currentState.relevant">
<!-- Render group nodes -->
<FormGroup v-if="isGroupNode(node)" :node="node" />
<!-- Render repeat nodes -->
<RepeatRange v-else-if="isRepeatRangeNode(node)" :node="node" />
<!-- Render leaf nodes like string, select, etc -->
<FormQuestion v-else-if="isControlNode(node)" :question="node" />
<ExpectModelNode v-else :node="node" />
</template>
</template> Possible Approaches
A re-write could be a lot of work (let’s assess it…), so I’m leaning more towards a web component wrapper for the Vue OdkWebForm component. Custom Question ComponentsHowever, we also have a parallel concern, around adding custom question types. There are two approaches I can think of:
Where should we go from here?
The perfect solutionJust a quick note to say IMO, the perfect solution would:
|
@spwoodcock , great write up! I concur with most of what's being said. Because of the tight timeline, I vote for the following: Phase 1:
Phase 2:
Phase 3:
Recognizing I was sorta pushing for the iframe approach earlier, I've changed my mind :-). Iframes can be nice if the code base is settled and there's no rush, but I believe we find ourselves in a different situation at the moment. |
Sounds like a plan! We should build upon the Web Component wrapper that ODK worked on (linked above) if possible, else failing that implement our own. I still bet that bundling both Svelte and Vue (for now) will give an equivalent or smaller bundle size than React 😂 |
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
The text was updated successfully, but these errors were encountered: