# Choice interface with HTML

**URL:** https://support.prodi.gy/t/choice-interface-with-html/478
**Category:** Uncategorized
**Tags:** front-end, done
**Created:** [April 9, 2018, 8:13pm UTC](https://support.prodi.gy/t/choice-interface-with-html/478 "2018-04-09T20:13:24Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![chssch](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/chssch/32/259_2.png) [@chssch](https://support.prodi.gy/u/chssch)
#### Post date: [April 9, 2018, 8:13pm UTC](https://support.prodi.gy/t/choice-interface-with-html/478/1 "2018-04-09T20:13:24Z")

</div>

Hi, I’m running the choice interface and try to get the data rendered as HTML, if I contruct this minimal example:

```
@prodigy.recipe('choice')
def choice():
    stream = [{
        'label': 'SOME_LABEL',
        'text': 'hello {}'.format(i),
        'html': "<b>Bold {}</b>".format(i),
        'options': [{"id": 1, "text": "Apple"}, {"id": 2, "text": "Google"}, {"id": 3, "text": "McDonalds"}]
    } for i in range(10)]

    return {
        'view_id': 'choice',
        'dataset': False,
        'stream': stream
    }

```

it still renders the text field. Any hints how to render a HTML template together with choice?

---

<div class="post-metadata">

### Author: ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)
#### Post date: [April 9, 2018, 8:42pm UTC](https://support.prodi.gy/t/choice-interface-with-html/478/2 "2018-04-09T20:42:07Z")

</div>

Interesting! What happens when you remove the `'label'` key from your stream?

I need to double-check to verify this, but here’s my suspicion: the logic to determine which interface to render checks for the label first and if found, uses the `classification` interface. The `classification` interface can render text, images and spans – but not HTML, so it falls back to the text. If there’s no label, Prodigy will check for `'html'` next and should then use the HTML interface within the `choice` task.

Allowing the `classification` UI to render HTML might be a good idea, though – no idea why it currently doesn’t. I guess it just never came up until now.

---

<div class="post-metadata">

### Author: ![chssch](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/chssch/32/259_2.png) [@chssch](https://support.prodi.gy/u/chssch)
#### Post date: [April 9, 2018, 9:11pm UTC](https://support.prodi.gy/t/choice-interface-with-html/478/3 "2018-04-09T21:11:08Z")

</div>

Okay, cool. Yeah, it works without a label. I was trying to use a `TextClassifier` recipe to work with HTML and choice (to sub-categorize an existent classification). Probably I need to remove the label from the `stream` and add it on `update` again.

---

<div class="post-metadata">

### Author: ![chssch](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/chssch/32/259_2.png) [@chssch](https://support.prodi.gy/u/chssch)
#### Post date: [April 10, 2018, 5:30am UTC](https://support.prodi.gy/t/choice-interface-with-html/478/4 "2018-04-10T05:30:19Z")

</div>

The remove/add label workaround seem to work 😀. Another thing I came across is that I can’t use key shortcuts [1]-[9], the frontend displays these messages in the developer console:

```
bundle.js:1 Uncaught TypeError: n.props.updateChoice is not a function
    at Object.n.handleShortcuts [as handler] (bundle.js:1)
    at r._handleShortcuts (bundle.js:1)
    at e.exports [as fireCallback] (bundle.js:1)
    at e.exports [as handleKey] (bundle.js:1)
    at e.exports.r._combokeys.handleKey (bundle.js:1)
    at e.exports (bundle.js:1)

```

Is this a bug or a configuration problem on my side?

---

<div class="post-metadata">

### Author: ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)
#### Post date: [April 10, 2018, 9:44am UTC](https://support.prodi.gy/t/choice-interface-with-html/478/5 "2018-04-10T09:44:20Z")

</div>

> [@chssch](#):
>
> Is this a bug or a configuration problem on my side?

Ah, damn – I just checked and looks like this is a bug. Thanks for the report. Already fixed it and the fix will be included in the next release (we're planning on pushing a smaller point release today that fixes a bunch of small things).

---

<div class="post-metadata">

### Author: ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)
#### Post date: [April 10, 2018, 8:32pm UTC](https://support.prodi.gy/t/choice-interface-with-html/478/6 "2018-04-10T20:32:06Z")

</div>

Fixed in `v1.4.2`! The `classification` interface now also allows HTML, so your code should work as expected.

(Btw, off-topic, but if you want to test the new experimental UI translation feature I’m working on, you can set `"ui_lang": "de"` in your `prodigy.json` 😉)

---

<div class="post-metadata">

### Author: ![steve](https://avatars.discourse-cdn.com/v4/letter/s/f19dbf/32.png) [@steve](https://support.prodi.gy/u/steve)
#### Post date: [June 7, 2018, 12:32am UTC](https://support.prodi.gy/t/choice-interface-with-html/478/7 "2018-06-07T00:32:32Z")

</div>

I’m still getting `TypeError: n.props.updateChoice is not a function` in `v1.4.2` when I’m trying to use keyboard shortcuts in the choice interface. I get the same error using the online demo, though Named Entities (manual) works fine. Is the bug fix slated for `v1.5.0`?

---

<div class="post-metadata">

### Author: ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)
#### Post date: [June 7, 2018, 8:15am UTC](https://support.prodi.gy/t/choice-interface-with-html/478/8 "2018-06-07T08:15:51Z")

</div>

@steve Yes, that’s fixed! Sorry about that. Just testing the wheels for `v1.5.0` btw 🎉
