Module: client/formManagementClient
Functions
createAction
▸ createAction<TSettings>(formId, action, token): Promise<Action<TSettings>>
Create action attached to a form in formio.
Type parameters
| Name |
|---|
TSettings |
Parameters
| Name | Type | Description |
|---|---|---|
formId | string | Id of the form to create action for. |
action | Action<TSettings> | Definition of the action to create. |
token | string | JWT token for formio. |
Returns
Promise<Action<TSettings>>
Throws
If the http request fails.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:329
createForm
▸ createForm(formSchema, token): Promise<Form>
Submit form to formio.
Parameters
| Name | Type | Description |
|---|---|---|
formSchema | FormSchema | Schema of the form to submit. |
token | string | JWT token for formio. |
Returns
Promise<Form>
Created form.
Throws
If the http request fails.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:85
deleteForm
▸ deleteForm(formPath, token): Promise<void>
Delete form from the form management system.
Parameters
| Name | Type | Description |
|---|---|---|
formPath | string | Path of the form to delete. |
token | string | JWT token for formio. |
Returns
Promise<void>
Throws
If the http request fails.
Throws
When a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:183
deleteFormById
▸ deleteFormById(formId, token): Promise<void>
Delete form from the form management system.
Parameters
| Name | Type | Description |
|---|---|---|
formId | string | Id of the form to delete. |
token | string | JWT token for formio. |
Returns
Promise<void>
Throws
If the http request fails.
Throws
When a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:202
exportFormSubmissions
▸ exportFormSubmissions(formId, root0): Promise<Blob>
Export form submissions from formio.
Parameters
| Name | Type | Description |
|---|---|---|
formId | string | Id of the form to export. |
root0 | Object | Options for exporting form submissions. |
root0.filters? | { comparedValue: string ; fieldPath: string ; operation: "contains" }[] | List of filters to apply. |
root0.format | "json" | "csv" | Format to export the submissions in. |
root0.token | string | JWT token for formio. |
Returns
Promise<Blob>
Blob with exported data in given format.
Throws
If the http request fails.
Throws
When a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:140
loadFormById
▸ loadFormById(formId, token): Promise<Form | null>
Load form with given id from formio.
Parameters
| Name | Type | Description |
|---|---|---|
formId | string | Id of the form to load. |
token | string | JWT token for formio. |
Returns
Promise<Form | null>
Form with given id or null if not found.
Throws
If the http request fails.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:52
loadFormByPath
▸ loadFormByPath(relativeFormPath, token): Promise<Form | null>
Load form with given path from formio.
Parameters
| Name | Type | Description |
|---|---|---|
relativeFormPath | string | Relative path to the form (including leading slash). |
token | string | JWT token for formio. |
Returns
Promise<Form | null>
Form with given path or null if not found.
Throws
If the returned http status is not OK.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:16
loadForms
▸ loadForms(root0): Promise<{ data: Form[] ; totalCount: number }>
Load forms from the form management system.
Parameters
| Name | Type | Description |
|---|---|---|
root0 | Object | Options for loading forms. |
root0.filters? | { comparedValue: string ; fieldPath: string ; operation: "contains" }[] | List of filters to apply. |
root0.pagination | Object | Pagination settings. |
root0.pagination.limit | number | - |
root0.pagination.offset | number | - |
root0.sort? | Object | Sorting settings. |
root0.sort.field | keyof FormSchema | "_id" | - |
root0.sort.order | "asc" | "desc" | - |
root0.tags? | string[] | List of tags which must be present on the form. |
root0.token | string | JWT token for formio. |
Returns
Promise<{ data: Form[] ; totalCount: number }>
List of forms.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.
Throws
If the Content-Range header in the response is invalid or the total count is unknown.
Defined in
src/web-app/src/client/formManagementClient.ts:230
loadSubmission
▸ loadSubmission(formPath, submissionId, token): Promise<Submission | null>
Load submissions from formio.
Parameters
| Name | Type | Description |
|---|---|---|
formPath | string | Path of the form to load submissions from. |
submissionId | string | Id of the submission to load. |
token | string | JWT token for formio. |
Returns
Promise<Submission | null>
Submission or null if the returned status is 404.
Throws
If the http request fails.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:357
loadSubmissions
▸ loadSubmissions(formId, root0): Promise<{ data: Submission[] ; totalCount: number }>
Get submissions of a form.
Parameters
| Name | Type | Description |
|---|---|---|
formId | string | Id of the form to load submissions from. |
root0 | Object | Options for loading submissions. |
root0.filters? | { comparedValue: string ; fieldPath: string ; operation: "contains" }[] | List of filters to apply. |
root0.pagination | Object | Pagination settings. |
root0.pagination.limit | number | - |
root0.pagination.offset | number | - |
root0.sort? | Object | Sorting settings. |
root0.sort.field | string | - |
root0.sort.order | "asc" | "desc" | - |
root0.token | string | JWT token for formio. |
Returns
Promise<{ data: Submission[] ; totalCount: number }>
List of submissions.
Throws
If the http request fails.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.
Throws
If the Content-Range header is invalid or unknown.
Defined in
src/web-app/src/client/formManagementClient.ts:402
submitForm
▸ submitForm(formPath, submissionData, token): Promise<Submission>
Make a submission to a formio form.
Parameters
| Name | Type | Description |
|---|---|---|
formPath | string | Path of the form to submit to (including leading slash). |
submissionData | unknown | Form data to submit. |
token | string | JWT token for formio. |
Returns
Promise<Submission>
Created submission.
Throws
If the http request fails.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:111
updateForm
▸ updateForm(formSchema, token): Promise<Form>
Update form in the form management system.
Parameters
| Name | Type | Description |
|---|---|---|
formSchema | Form | Form schema to save to server. |
token | string | JWT token for formio. |
Returns
Promise<Form>
Updated form.
Throws
If the http request fails.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.
Defined in
src/web-app/src/client/formManagementClient.ts:303
updateSubmission
▸ updateSubmission(formPath, updatedSubmission, token): Promise<Submission>
Update submission in the form management system.
Parameters
| Name | Type | Description |
|---|---|---|
formPath | string | Path of the form of which to update the submission. |
updatedSubmission | Partial<Submission> & Pick<Submission, "data" | "_id"> | Updated submission (used to replace submission with the same _id). |
token | string | JWT token for formio. |
Returns
Promise<Submission>
Updated submission.
Throws
If the http request fails.
Throws
If the response is not valid json or when a network error is encountered or CORS is misconfigured on the server-side.