Skip to content
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

Add support for links_to_form in form config field params #280

Closed
signebedi opened this issue Jun 23, 2024 · 4 comments
Closed

Add support for links_to_form in form config field params #280

signebedi opened this issue Jun 23, 2024 · 4 comments

Comments

@signebedi
Copy link
Owner

When we have a form lookup, we should enable end users to pass the following field parameter to the form config:

links_to_form: str | None, 

If a str, then this should do a lookup and render the form in an iframe. Note this only really works for radio or select fields. Multiselect fields will struggle with it.

Originally posted by @signebedi in #150 (comment)

@signebedi
Copy link
Owner Author

signebedi commented Jun 23, 2024

We should write this as a document database metadata field. The structure should follow something like:

[
  (
    field_name, 
    form_name, 
    [
      display_field, 
      display_field
    ]
  ),
]

As an alternative to a list of tuples, we can also write them as a dictionary. Pros and cons to both approaches. Dictionaries make enforcing one-field-one-mapping a little easier...

{
  "field_name": {
    "form_name": external_form_name, 
    "display_fields": [
      display_field, 
      display_field
    ]
  }
} 

@signebedi
Copy link
Owner Author

Add support for query params to link_to_form logic
In essence, we want to add options to sort and filter the results of the lookup before showing it to the user.

@signebedi
Copy link
Owner Author

Add push_populate field for links_to_form fields
This is a nested key-value mapping. What it does is pushes values from a linked form to fields of the current form onChange.

push_populate:
  current_form_field_1: linked_form_field_1
  current_form_field_2: linked_form_field_2
  current_form_field_3: linked_form_field_3

These fields must exist in the current form config, but they need not be of any particular input type ... though there may be unexpected behaviors if types do not match. The recommended approach may be that these are hidden fields. I think this all is done in the javascript.

@signebedi
Copy link
Owner Author

Add sort_by options for link_to_form logic
This means allowing us to specify the field/s to sort by, and the method (ascending, descending). This will always be alphabetical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant