Hi,
I’m attempting to use the multi-select field to allow CMS users to assign genres to individual ‘Shows’. The Select options are being set from the following URL : https://www.staging.noodsradio.com/genres.json
Unfortunately, the search function in the multiselect doesn’t seem to be working!? I’ve not had this problem when using the MS with hardcoded options. Is the formatting wrong in my JSON?
Here’s a video of the issue happening:
I also get the following error in the console
Did you set a value
? It looks like Kirby doesn’t find a key for the options. Please have a look at this example in the docs:
Genres: [
{
parent: "Ambient / New Age",
name: "Ambient"
},
{
parent: "Ambient / New Age",
name: "Cosmic"
},
...
What do you mean by set a value? As far as I can see the text and value options are set correctly…
genretags:
label: Genres for the mix
type: multiselect
search: true
max: 5
options: api
api:
url: https://www.staging.noodsradio.com/genres.json
fetch: Genres.sortBy("name", "asc")
text: "{{ item.name }}"
value: "{{ item.name.slug }}"
I don’t think you can use sortBy
on Genres… Kirby expects a string here with the column name you want to fetch.
I’m following the docs and there is a example applying the SortBy Method
fetch: Companies.sortBy("name", "desc")
Oh, ok, wasn’t aware of that.
But I remember I had the same issue recently and it didn’t work in my valet environment with Kirby 3.4.2 while switching to Mamp or Kirby 3.3.6 “solved” the issue for me (for the moment).
No worries!
Ah, I’m using the latest version (3.3.6) and running my local env with Valet. However it’s happening on my staging environment as well. Would where the JSON file is hosted make a difference?
I just tested your field with Kirby 3.3.6 on local with Valet and your API and works without problems:
Hi there,
This still doesn’t work for me.
My site is running 3.4.4 which it looks like is the latest version of Kirby.
FYI the error only occurs once you type in to the search field.
The console error that is thrown is in compiled code so it’s making it very hard to debug!
Well, for some reason, I cannot read your file. It only works for me, if I put the json string into a route and use that as options. No idea why.
So doing something like this would work?