bgcarlisle / Numbat

Numbat Systematic Review Manager
GNU Affero General Public License v3.0
7 stars 0 forks source link

Conditional display #31

Open maia-sh opened 3 years ago

maia-sh commented 3 years ago

Hi @bgcarlisle , the conditional display is awesome!! thanks! To confirm, I can show/hide conditionally based on a form element but NOT on something in the reference set. I.e. Yes: If user selects clinical trial, then show follow-up question on whether the trial is on COVID. No: If reference set has variable that says it's a clinical trial, then show question on whether the trial is on COVID.

Just want to make sure I understand the possibilities as I make some design choices. Thanks!

bgcarlisle commented 3 years ago

That's currently not supported, but could add that to the wish-list!

maia-sh commented 3 years ago

If you think it would be of use for others too, then yea! In the meanwhile, I'm wondering whether I can conditionally display text (so not quite the same as a whole element) using HTML, but I'm no pro with HTML or sure what Numbat allows. I'm thinking something like (where $is_clinical_trial is a variable in the refset):

if ($is_clinical_trial) {
  "This is a clinical trial. Woopee!"
}
bgcarlisle commented 3 years ago

The simplest way to do it, if you're okay with pre-processing your reference set a bit, is to put the text into the column:

is_clinical_trial
This is a clinical trial. Woopee!
This is a clinical trial. Woopee!
[Nothing]
This is a clinical trial. Woopee!

Then add a reference data element and put the following in it:

$is_clinical_trial

Alternatively, you can have something like this:

is_clinical_trial
display: none;
display: none;
[Nothing]
display: none;

Then add a reference data element and put the following in it:

<div style="$is_clinical_trial">
This is a clinical trial. Woopee!
</div>
maia-sh commented 3 years ago

Thanks, Murph! I currently have something like the first, but we're going to need a few more such columns so was just checking whether I could take advantage of any new conditional magic. I will keep the current process for now :)