oTree Forum >

Two "Next" buttons which direct to different pages

#1 by pjp (edited )


I am encountering an issue that I was able to resolve in oTree 3 but am struggling with in oTree 5. Additionally, I am experiencing some peculiar bugs where parenthesis ()()() appear before hidden input fields. The primary challenge is implementing two separate "Next" buttons that function as follows:

*Each button should record either a 1 or a 0 based on which button is clicked.

*Both buttons should retain the "next_button" functionality, which includes recording the value (1/0), submitting the form, and proceeding to the next page.

Let's refer to the two buttons as follows:

*Button FA (direct to Final Page A): Records a value of 1 when clicked.

*Button FB (direct to Final Page B): Records a value of 0 when clicked.

This functionality should be implemented on Page F, which also includes an MG slider. The slider is initially hidden and only revealed when clicked. Its default value is set at the point where the participant clicks (thus unbiased). The MG slider has some associated JavaScript functionalities that need to be considered, but the sliders themselves work flawlessly, thanks to https://gitlab.com/gr0ssmann/otree_slider.

Important Requirements:

*The slider values must always be recorded, ie., require participant to select some values.

*The buttons FA and FB should only be activated once the sliders are revealed and values are selected. Participants should not be able to proceed to FA or FB without selecting the slider values.

Please find the attachments with the current code. The __init__.py file is fully functional, but the F.html file requires the aforementioned fixes. I have attempted several solutions but have not been successful.

Thank you in advance for your assistance.

Write a reply

Set forum username