I am getting an error, which I did not face before though I defined the formfield tag as usual notation. The error I am getting is :
Debug info
The form field vote2 has errors,
but its error message is not being displayed, possibly because
you did not include the field in the template.
There are 2 ways to fix this:
-
Include the field with the formfield tag, e.g.
{{
formfield "vote2"
}}
-
If you are not using formfield but are instead
writing the raw HTML for the form input,
remember to include
{{
formfield_errors 'vote2'
}}
somewhere in your page's HTML
I am sharing the portion of the code and the screen shot of the error. I tried various things but could not resolve it. Can anyone pleas help me out??
I have defined two player level fields as follows:
vote1 = models.IntegerField(
choices=[
[1, "PLAYER A"],
[2, "PLAYER B"],
[3, "PLAYER C"],
], label="Which player do you like to select as delegate in group group?"
)
vote2 = models.IntegerField(
choices=[
[1, "PLAYER D"],
[2, "PLAYER E"],
[3, "PLAYER F"],
], label="Which player do you like to select as delegate in group group?"
)
And in HTML I have my code for the page as follows:
{{ if player.subgroup_id == 1 }}
{{ formfield 'vote1' }}
{{ elif player.subgroup_id == 2 }}
{{ formfield 'vote2' }}
{{ else }}
{{ endif }}