
The form field risk has errors, but its error message is not being displayed, possibly because you did not include the field in the page. There are 2 ways to fix this:

On Mar 3, 2021, at 10:05 PM, Daniel Frey <danie...@iop.unibe.ch> wrote:
Hello everybody
I found a problem with the formfields using IntegerFields with choices.I created a survey-question with 10 different options in as follows:class Player(BasePlayer):
risk = models.IntegerField(widget=widgets.RadioSelect,
label="Please indicate your answer on the following scale: 1 means: not at all willing to take risks, 10 means: very willing to take risks.",
choices=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10])I want to present the choices in a html-table, like this:
<risks.jpg>If I test it, a message on the Debug info appears:The form field risk has errors, but its error message is not being displayed, possibly because you did not include the field in the page. There are 2 ways to fix this:
- Include the field with the formfield tag, e.g. {% formfield "risk" %}
- If you are not using formfield but are instead writing the raw HTML for the form input, remember to include {{ form.risk.errors }} somewhere in your page's HTML.
As I'm not using the {% formfield 'risk' %}-tag, I included {{ form.risk.errors }} in the html-page.Then, something very weird happens: At the place I included the error (right at the end, after </table>), two brackets appear on the html-page:
<risks2.jpg>I believe this is a bug in the latest oTree version, right?
--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/b7787960-87f8-4ddd-908b-6edcb66813f4n%40googlegroups.com.
<risks2.jpg><risks.jpg>