oTree Forum >

Record user's input while updating on the current page

#1 by tenuki,

Hello,

I have created a slider for users to enter input and record that input as a field. However, is there a way to update that value in the current page?

Thank you.

Best,
James

#2 by ccrabbe,

Hi James -

You can do this with javascript by defining an onchange or oninput function for the range input and having that function update a label with the value.

If you look at the "slider live label" demo in the otree-snippets library you can see an example: https://www.otreehub.com/projects/otree-snippets/

Thanks,
--Chris

#3 by tenuki,

Hi Chris,

Thanks for your reply. But can we also keep the input type the same as the field? For example, I'm trying to record it as CurrencyField, but the default input is integer.

Write a reply

Set forum username