Dynamic options via JSON API on field not working

Iā€™m on Kirby 2.3 and trying to get a blueprint field to accept JSON options, as described in the docs. My setup is the same as the docs:

title: Last name letter
pages: true
files: false
fields:
    title:
        label: Letter
        type:  text
    category:
        label: Category
        type: checkboxes
        default: architecture
        options: http://192.168.1.141/dvddb/directorapi/api.json

api.json is:

{
  "id": "Design",
  "architecture": "Architecture",
  "photography": "Photography",
  "3d": "3D",
  "web": "Web"
}

Yet no checkboxes are displayed when editing the page. Why would that be?

The URL probably does not validate:

public function isUrl($url) {
    return
      v::url($url) or
      str::contains($url, '://localhost') or
      str::contains($url, '://127.0.0.1');
  }

Although it should. Can you test on a remote url if it is the validator or something else? Or try localhost?

Update: just tested this on my system and when I call http://192.xxx/ā€¦ it does not work either, while localhost does.

2 Likes

You are right, replacing the IP with localhost resolves the problem. Thank you!