Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

[HELP] calling loadRole and loadAction #145

@TriStarGod

Description

@TriStarGod

Environment

Please provide as many details as you can:

  • Hosting type
    • Form.io
    • Local deployment
      • Version:
  • Formio.js version: 4.14.8

When I load a form, I can't load anything else that might be connected with it without creating a new Formio or setting static variables
ie.

const formio = new Formio(`${baseUrl}/form/${form}`);
// these works
await formio.loadForm()
await formio.loadRoles()
await formio.loadActions()
await formio.actionInfo(name);

// but these dont
await formio.loadRole();
await formio.loadAction();

// unless I
formio.actionId = "blah doesn't matter, just has to be true"; 
formio.actionUrl = `${baseUrl}/form/${formId}/action/${actionId}`;
await formio.loadAction();
// or create a new Formio with the url set to actionUrl or roleUrl

Expected behavior

// To reuse Formio object without doing
formio.actionId = "blah doesn't matter, just has to be true"; 
formio.actionUrl = `${baseUrl}/form/${formId}/action/${actionId}`;
// but instead
formio.loadAction(actionId);

Observed behavior

Its not working as I expect so I'm assuming I'm doing something wrong. Any advice to optimize my use of this great library?

Example

If possible, please provide a screenshot, live example (via JSFiddle or similar), and/or example code to help demonstrate the issue.

For code or form JSON, please enclose in a code block:

// your code here

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions