Multiple choice - deselect

Hi All,
I have a Challenge whereby I want a Mobile Worker to select from the Multiple Choice Question which says: What is the Position of the Member in the Group; Options - Chairperson, Vice-Chairperson, Secretary, Others (Specify). From this Question, this implies that there can only be one Chairperson, Vice-Chairperson, and Secretary, then Others Positions will fall in "Others (Specify)". So, what I need to see is that When one of these Positions is selected, then it cannot be selected again thereby avoiding data errors of having cases of two Chairpersons or Vice-chairpersons or Secretaries in one Group. Thank you.

Hi,

Is all of this happening in one form, or are the roles you are referring to being attached to Case Data that needs to influence the entry of a different form in the future?

-Clayton

Its Happening within one Form since its a repeat Group registering committee Members and that is why we have to capture only one Chairperson etc. Thank you

Hi,

You can use the count() function along with a Filter expression to create a display condition which will allow you to show the user an error that they cannot bypass if they select the same role for more than one person.

If you copy the chunk of text below and paste it into the form builder it should provide an example that demonstrates this behavior:

Form Builder clip	version 1
id	type	labelItext:en-default	constraintMsgItext:en-default	appearance	calculateAttr	comment	constraintAttr	rawDataAttributes	relevantAttr
/wrapper_repeat_uniqueness	Group	null	null	null	null	null	null	null	null
/wrapper_repeat_uniqueness/repeater	Repeat	null	null	null	null	null	null	"{""jr:template"":""""}"	null
/wrapper_repeat_uniqueness/repeater/name	Text	Name:	null	null	null	null	null	null	null
/wrapper_repeat_uniqueness/repeater/role	Select	Role	null	null	null	null	null	null	null
/wrapper_repeat_uniqueness/repeater/role/leader	Choice	Leader	null	null	null	null	null	null	null
/wrapper_repeat_uniqueness/repeater/role/supporter	Choice	Supporter	null	null	null	null	null	null	null
/wrapper_repeat_uniqueness/leader_check	Trigger	"You can only have one ""Leader"", but the following people are all chosen as leaders: <output value=""#form/wrapper_repeat_uniqueness/optional_list_of_leaders"" /> "	Please go back and ensure that only one person has been chosen as the leader	minimal	null	null	false()	null	#invalid/xpath count(`#form/wrapper_repeat_uniqueness/repeater`[role = 'leader']) > 1
/wrapper_repeat_uniqueness/optional_list_of_leaders	DataBindOnly	null	null	null	"join("", "", /data/wrapper_repeat_uniqueness/repeater[role = 'leader']/name)"	This is optional, and can be removed if overly complex	null	null	null

Hi Clayton_Sims,
Am just a beginner as regards to CommCare HQ, so kindly how and where to Past the code provided, because I tried running under the form's XML Source editor but I get Errors.
Thank you.

Hi,

You can load into your form by doing the following

  1. Copy that text in its entirety
  2. Open the form builder in CommCare HQ
  3. Click on the Question List
  4. Press CTRL-V on your keyboard
    It should insert the questions directly into the currently edited form.

-Clayton

Thank you very much Clayton_Sims
It works Perfectly for ME.
Thank you once Again