#1 by Javier
Hello. I am having troubles with a form in an experiment I am currently programming, and would be grateful if someone could shed some light on the error. In __init__.py, within the Player class, I have defined this variable, among others: # VARIABLES FOR QUESTIONNAIRE ABOUT HOW MANY RIGHT ANSWERS THEY HAG correct_2x2_guess = models.IntegerField(choices=[0, 1, 2, 3, 4, 5, 6], label='') Also within __init__.py, I define the class for the webpage and the formfields: class ExPostQuestions(Page): form_model = 'player' form_fields = ['correct_2x2_guess', ..., ] In the ExPostQuestions.html, for each of the formfields, I have a code similar to this one: {{formfield_errors 'correct_2x2_guess'}} Some text, then the dropdown menu within the same line <select id="correct_2x2_guess" name="correct_2x2_guess" size="1"> {{for choice in form.correct_2x2_guess }} <option value={{choice}}></option> {{endfor}} </select> and the text goes on. (I want the dropdown menu within the line) And the send button, for which I tried these three different setups: <button type="button" class="otree-btn-next btn btn-primary" onclick="show_next_page()">Siguiente</button> <button>botón</button> {{ next_button }} {% block script %} <script> function show_next_page(){ //liveSend({"instruction": "next_page" //}) var form = document.getElementById("form"); form.submit() } </script> {% endblock %} No matter the button, I obtain this error when sending the form: Invalid Choice: could not coerce Not a valid choice I haven't been able to figure the error, or find some related information on the web. Does anyone have an idea on how to correctly set this up? Thank you for your help and time, best regards, Javier.