"Form-field" to be filled by specific players

352 views
Skip to first unread message

Zhang Sr

unread,
Nov 1, 2021, 1:09:42 PM11/1/21
to oTree help & discussion
Hi all,

I am facing a question on "form-field" for different players, I try to search previous posts, seems no one asked it before. 

In one of my pages, I need to show different message for the players. To make it simpler, for player's id =1, he/she see a simple message; the rest players ( id !=1) need to fill in a formfield. ( to input a number as their decisions).

In html, i wrote as follows:

{{ if player.id_in_group == 1}}
Please wait for your group members to make their decisions!

{{ else}}
Now please make your decision.
{{ formfields }} 

{{ endif}}

and in the form_fields part i selected one field.

The problem is the message is correctly shown to different players, but the player's id =1 cannot click on the next button to proceed, he/she has to fill in the form where the form is not shown at all.

My question is is it because as long as the form-field is selected, everyone on this page has to fill in? Is there any way that only specific players to input something?

Thank you so much!
Shaorong

Chris Crabbe

unread,
Nov 1, 2021, 2:07:21 PM11/1/21
to Zhang Sr, oTree help & discussion
Hi Shaorong -

What you need to do is also specify a different value for form_fields for the different players.

oTree allows you to do this with its get_form_fields method:

Thanks,
--Chris

--
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/6d7c2191-ae9e-4aae-bcaf-ca0cd869bac8n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages