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

Form field describing options represented by a link to another resource #41

Open
tanordheim opened this issue Sep 19, 2019 · 0 comments

Comments

@tanordheim
Copy link

Hi,

I'm evaluating Ion for a project I'm building here and I'm trying to find a good way to represent a form field where the available options of that form field are expressed as a link to another resource. The UI requirements here are that we want to have a text input field that - when the user starts typing - automatically suggests viable options matching the input and allows the user to select which of the suggestions to use as the field value. The list of available options can be huge, so it's best if we could avoid embedding this directly in the payload and do client side filtering on it by using form field options.

Basically what I would like to express is maybe a search query as the field type, like this:

"create": {
  "href": "https://api.example/things",
  "rel": ["create-form"],
  "method": "POST",
  "value": [
    {
      "name": "userId",
      "type": "{something smart}",
      "value": {
        "href": "https://api.example/people", // tell the client where the list of options can be found,
        "value": { // needs a smarter name
         "name": "query"
        }
      }
    }
  ]
}

This would instruct the client to do GET https://api.example/people?query=foo when the user types foo into the userId field, and to use the results from that query to populate the options collection of the form field. The suggested JSON here is just pulled out of thin air and is not to be seen as a suggestion of a structure that might work - but I hope my point comes across clearly using this example.

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