Although I am not completely sure what happens when you click a button that takes you to the next page. Does the redirect happen before the javascript? Is it a simultaneous thing where you just hope your browser will execute a small JS script before oTree redirects the browser window to a new page? Maybe Chris can comment on that.
The form field timeJS 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 Apr 5, 2021, at 7:16 PM, 'Juanfran' via oTree help & discussion <ot...@googlegroups.com> wrote:
Attached there is the HTML example I am trying to develop in case this can help someone to solve my problem.
The only thing needed in models.py to run it should be to add timeJS = models.FloatField() in the player class.I don't understand why, although it enters into the JS function (I checked it using alert(), thank you Tomasso for your suggestion), it does not save anything in the field timeJS (it remains blank).I followed Rok and Chris suggestions of the documentation, but it seems that document.getElementById('timeJS').value is not working.Does anybody know why?Thank you in advance
Kind regards,JuanfranPS: I also attach a screenshot of the code in case it can help or fasten the process.
--
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/a3964967-abd2-400c-96e9-85ef7ff9b943n%40googlegroups.com.
<GettingID.html><htmlfile.png>
On Apr 5, 2021, at 7:19 PM, Chris @ oTree <ch...@otree.org> wrote:
Did you put timeJS in your page’s form_fields and submit the page?