Can't use 2 widgets in one field?

papi Jo's picture
Forums: 

Hi fellow developers,

In a custom H5P activity I have a text field in which I need 2 widgets:

  • "widget": "html" to enable end-user to format text
  • "widget": "showWhen" to display that text field or not, depending on the boolean value of another field.

It seems that I can only have one of these 2 widgets for that text field. Is that the normal behaviour? Is there a workaround?

Thanks!

Summary: 
using widgets for text field in semantics
papi Jo's picture

Any takers?

otacke's picture

Hi Papi Jo!

I think your only option is to wrap the text field into a group and attach the showWhen widget to the group. That's a little ugly as a workaround, but can be made a little nicer if you add a custom form widget to restyle the editor.

Best,

Oliver 

papi Jo's picture

Thanks Oliver,

Just tried your solution of wrapping text inside a group and it does work.

otacke's picture

Hi Papi Jo!

As I mentioned: It's a little ugly because of the extra group stuff in the editor, but it should do the trick and some custom CSS may come to the rescue.

Best,
Oliver