Back button w/out implementing the app in one html file

323 views
Skip to first unread message

Kate Hahn-Madole

unread,
Dec 23, 2021, 9:14:58 AM12/23/21
to oTree help & discussion
Hello, 

We're working on a survey with many pages that we need a "back" button for. In the past, we've implemented this by creating one html file that contains the entire survey, but we've run into issues with participants refreshing the page and then losing all their results. 

Is there a way to have a back button without the single html implemntation? Or a way to implement a "save" button in the single html that would allow participants to send data to the database periodically? Could we do this somehow with the liveSend function?

Really appreciate any advice! Thanks!

Kate

Chris @ oTree

unread,
Dec 23, 2021, 9:33:33 AM12/23/21
to oTree help & discussion
oTree has no back button, so you would need to do it in one page.

To save people's inputs on page reload, the simplest way is probably to use the persist_raw app here: https://www.otreehub.com/projects/otree-snippets/

If you're using oTree formfields, you can use JavaScript to add the 'persist' class to all <input> elements. Do that before the line that loads persist-raw.js.

you could also use live pages.



Kate Hahn-Madole

unread,
Jan 13, 2022, 10:53:46 AM1/13/22
to oTree help & discussion
Thanks so much! We are using the persist_raw app now. 

I have a follow-up question: 

We have the survey set up so that a participant goes through multiple "pages" that are actually one template, and then a final end page that is a separate template. The problem is that if the participant presses "enter" when filling out one of the text fields on one of the mini pages, they are then skipped through the remaining mini pages and taken to the end page. Do you know how we can decouple text field from recognizing the enter button?

Thank you!

Kate

Chris @ oTree

unread,
Jan 13, 2022, 4:07:05 PM1/13/22
to Kate Hahn-Madole, oTree help & discussion
You can look up how to do this with JavaScript. 

Sent from my phone

On Jan 13, 2022, at 7:53 AM, Kate Hahn-Madole <khahn....@gmail.com> wrote:

Thanks so much! We are using the persist_raw app now. 
--
You received this message because you are subscribed to a topic in the Google Groups "oTree help & discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/otree/IVGmqcdsERM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/072ad7cf-8c32-4006-81c6-6b19b2b09598n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages