Mutually exclusive formtoggle inputs

The variable is Abdominal pain (AP).

In the questionnaire the patient MUST actively mark if he/she has AP - cannot do it by simple omission of a AP input. Then if they mark that they have AP, further inputs are to open up (individually) such as site of AP, severity of AP, Characteristics of AP, Radiation of AP, Trigger to AP & so (each with 10 or so variables).

However, if I pick No AP can the AP toggle be blocked or hidden and vice versa so that both cannot be picked?

Because it is a questionnaire it needs to be super easy and tick boxes only preferable.

Would a formmenu command be most suitable here? That's a natural UI component when you can only select one out N different options (and at least one must be selected):

Abdominal pain: {formmenu: No Pain; Pain; name=AP}

{if: AP=="Pain"}Additional Questions for Abdominal pain...{endif}

If you need a no response option you could do:

Abdominal pain: {formmenu: Select response; No Pain; Pain; name=AP}{if: AP=="Select response"}{error: You must select a response to the abominable pain question; block=yes}{endif}

{if: AP=="Pain"}Additional Questions for Abdominal pain...{endif}

The block setting above on the {error} command prevents the form being submitted until an option is selected.

The preference was a tick box selection - for speed and convenience and then if the yes box is ticked to open up further options, such as site, severity, etc each with a drop down menu.

If you wanted a checkbox, I might try something like the following. It also uses the {error} command to ensure the form is filled out correctly:

AP: {formtoggle:name=no_pain}{endformtoggle} {formtoggle:name=has_pain}
Additional questions if you have pain{endformtoggle}
{if: (has_pain and no_pain) or (not has_pain and not no_pain)}{error:You must select one and only one AP option.; block=yes}{endif}

This is definitely what I am looking for.

Now can can add 3 requests:

  1. Is it possible to hide the warning in the Snippet Preview view from showing as this may distress clients?

  2. When I tick no_pain the final output is "Patient does not complain of any abdominal pain." but if I tick has_pain "the patient's pain is described as:" & a number of tick boxes appear

  3. if there was a 3rd option (lets say intermittent pain) and that ticking has pain makes available an additional panel of questions however ticking intermittent pain makes available a total separate and different panel of questions.

I just realised that you can edit out the warning sign & that you CAN tick both boxes (hence the warning sign)

And so that leaves points 2 & 3

  1. When I tick no_pain the final output is "Patient does not complain of any abdominal pain." but if I tick has_pain "the patient's pain is described as:" & a number of tick boxes appear

  2. if there was a 3rd option (lets say intermittent pain) and that ticking has pain makes available an additional panel of questions however ticking intermittent pain makes available a total separate and different panel of questions.

My best attempt is this demohttps://dashboard.blaze.today/snippet/6QPUBLg8M7qzpdz4Uy0W

If you have more than two options I would definitely go with a formmenu. You can extend the {if} command in the first example with some {elseif} branches to let you show different questions or text for different choices.

Also, the error command has an experimental "validate" setting that hides the error until the user attempts to submit the form. You can try that out to see how it works but note this is experimental we may change or remove it in the future.

{error: You need to fix me.; block=yes; show=validate}
(nothing shows in the preview here, but if you had a form with this, the error message would appear when you attempted to submit the form and it would block submission)

Can you make the "error" message NOT appear if the 2 options (say "NO_PAIN" and "PAIN") are both empty (as questions can be skipped in the questionnaire) BUT only appear when there is an error --> i.e. when BOTH options are ticked i.e both NO_PAIN and PAIN options are ticked. Thus if the patient doesn't want to the answer, then the final output will show nothing and so no wrong data input (but this will be allowed); what will NOT be allowed is entering conflicting data inputs - then the error message appears and hopefully submission of the form will be blocked.

Absolutely, that's a modification of the example above. Here you go:

AP: {formtoggle:name=no_pain}{endformtoggle} {formtoggle:name=has_pain}

Additional questions if you have pain{endformtoggle}

{if: has_pain and no_pain}{error:You must select only one AP option.; block=yes}{endif}

Thanks

George