Form field describing options represented by a link to another resource
tanordheim opened this issue · 0 comments
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.