bug? in showwhen library

papi Jo's picture
Forums: 

Bug reported on github at https://github.com/h5p/h5p-editor-show-when/issues/1

This semantics example triggers an error when in edit H5P content mode:

Uncaught Cannot follow field "cold".

"fields": [
      {
        "name": "winter",
        "type": "boolean",
        [...]
      },
      {
        "name": "cold",
        "type": "boolean",
        [...]
        "widget": "showWhen",
        "showWhen": {
          "rules": [
            {
              "field": "winter",
              "equals": true
            }
          ]
        }
      },
      {       
       	"name": "wearWarmCap",
        [...]
	"widget": "showWhen",
        "showWhen": {
          "rules": [
            {
              "field": "cold",
              "equals": true
            }
          ]
        }
      }
]
serettig's picture

I can confirm that this bug has been around for a long time. I think what causes this is the dependency of one showWhen widget on another showWhen widget. This doesn't work in the editor. I haven't seen the error when I was working on my library (it failed silently), though.