Nifty trick for inserting linked URLs in formmenu lists

A member in our community just asked me a really interesting question:

"I have some website links in my multiselect formmenu – how do I make it a hyperlink automatically when inserting so someone can just click the website link?"

I thought you might all find the solution handy, so here it is:

{note: preview=no}
{simplelist=[
"item 2",
"item 3"
]}

{linkslist=[
"Google.com"="http://google.com",
"Facebook.com"="http://facebook.com"
]}

{masterlist=merge(simplelist, keys(linkslist))}

{endnote: trim=right}

{note}
{formmenu: name=list; multiple=yes; values={=masterlist}}

{endnote: trim=right}

{repeat: for item in list; trim=right}
{if: includes(keys(linkslist), item)}{link: {=linkslist[item]}}{=item}{endlink}
{else}{=item}
{endif}{endrepeat}

And here's the explanation of how the snippet works:

There are two lists at the top.

  • "simplelist" is the list of simple items that don't contain a URL.
  • "linkslist" is the list of items that will become linked. You'll notice that this is a "keyed" list, in that you have a "key" and a "value" for every item.

All you need to do is edit these lists and insert the desired values. Some important notes:

  • Make sure each item is in quotation marks
  • For the "linkslist", make sure you copy the syntax exactly as it is i.e.
    "item name"="url link"
    with each pair of items separated by commas

You don't need to touch the "masterlist". Essentially, it's just combining the simplelist and the keys of the linkslist together into one list, so that they can be used as values inside the formmenu command.

Check it out and tell me what you think.

1 Like

Hi, @Cedric_Debono_Blaze

Thank you so much for this trick. I've been trying to adapt it to one necessity that I have and, until now, I can find out a correct way to do it. Do you mind helping me please?

I´m a medical doctor. I have created a numbers of snippets for me and my team by which we could insert treatment of any of our patients. Nowadays I use toggles like this:

**CURRENT TREATMENT: {formtoggle: name=Amlodipino.; default=no}{key:enter}-Amlodipino {formmenu: 5;10; default=5} mg vo cada {formmenu: 4; 6; 8; 12; 24; default=cada 12} horas. {endformtoggle}{formtoggle: name= Captopril (TA).; default=no}{key:enter}-Captopril {formmenu: 12.5; 25; 50; 100; default=50} mg vo cada {formmenu: 8; 12; 24; default= 24} horas.{endformtoggle}{formtoggle: name= Carvedilol.; default=no}{key:enter}-Carvedilol {formmenu: 3,12;6.25;12.5; default=6.25} mg vo {formmenu: cada 6; cada 8; cada 12; cada 24; default=cada 12} horas.{endformtoggle}{formtoggle: name= Clonidina (TA).; default=no}{key:enter}-Clonidina {formmenu: 75; 150; 300; default=150} ug vo {formmenu: monodosis; cada 4 horas; cada 6 horas; cada 8 horas; cada 12 horas; cada 24 horas; default=cada 24 horas}.{endformtoggle}{formtoggle: name= Dalteparina (TA).; default=no}{key:enter}-Dalteparina {formmenu: 2500; 5000; 7500; default=5000} U subcutáneas cada {formmenu: 12; 24; default=} horas a las {formmenu: 18; 6 y 18; default=18} horas.{endformtoggle}{formtoggle: name= Dexametasona.; default=no}{key:enter}-Dexametasona {formmenu: 4; 5; 8; 12; default= } mg iv {formmenu: cada 4 horas; cada 6 horas; cada 8 horas; cada 12 horas; cada 24 horas; monodosis; default= }.{endformtoggle}{formtoggle: name= Enalapril (TA).; default=no}{key:enter}-Enalapril {formmenu: 5;10;20; default=20} mg vo {formmenu: cada 12; cada 24; default=cada 24} horas.{endformtoggle}{formtoggle: name= Enoxaparina (TA).; default=no}{key:enter}-Enoxaparina {formmenu: 20; 40; 60; 80; default=40} U sc cada {formmenu: 12; 24; default=24} horas a las {formmenu: 18 horas; 6 y 18 horas; default=18 horas}.{endformtoggle}{formtoggle: name= Insulina Glargina (TA).; default=no}{key:enter}-Insulina Glargina {formtext: name=U Insulina Glargina; width=20} U cada {formmenu: 6; 8; 12; 24; default= 12} horas.{endformtoggle}{formtoggle: name= Insulina Glulisina (TA).; default=no}{key:enter}-Insulina Glulisina {formtext: name=U Insulina Glulisina; width=20} U cada {formmenu: 6; 8; 12; 24; default=12} horas.{endformtoggle}{formtoggle: name= Levodopa - Carbidopa (TA).; default=no}{key:enter}-Levodopa (100 mgr) - Carbidopa (25 mg) vo cada {formmenu: 6; 8; 12; 24; default=cada 12} horas.{endformtoggle}{formtoggle: name= Losartan (TA).; default=no}{key:enter}-Losartan {formmenu: 25;50;100; default=50} mg vo cada {formmenu: 8; 12; 24; default= 24} horas.{endformtoggle}{formtoggle: name= Metoprolol (TA).; default=no}{key:enter}-Metoprolol {formmenu: 25; 50; 100; default=50} mg vo cada {formmenu: 6; 8; 12; 24; default=cada 12} horas.{endformtoggle}{formtoggle: name= Prazocin (TA).; default=no}{key:enter}-Prazocin {formmenu: 1; 2; default=1} mg vo cada {formmenu: 6; 8; 12; 24; default= 12} horas.{endformtoggle}{formtoggle: name= Prednisolona (TA).; default=no}{key:enter}-Prednisolona {formmenu: 5;10;15; 20; 50; default=5} mg vo cada 24 horas.{endformtoggle}{formtoggle: name= Tramadol (TA).; default=no}{key:enter}-Tramadol.{endformtoggle}{formtoggle: name= Trazodona (TA).; default=no}{key:enter}-Trazodona.{endformtoggle}{formtoggle: name= Valsartán (TA).; default=no}{key:enter}-Valsartán {formmenu: 80; 160; 320; default=50}mg vo cada {formmenu: 6; 8; 12; 24; default=cada 12} horas.{endformtoggle}{formtoggle: name= Vasopresina.; default=no}{key:enter}-Vasopresina infusión iv.{endformtoggle}{formtoggle: name= Verapamilo (TA).; default=no}{key:enter}-Verapamilo {formmenu: 40; 80; 120; 160; 320; default=80} mg vo cada {formmenu: 6; 8; 12; 24; default=cada 12} horas.{endformtoggle}{formtoggle: name= Warfarina (TA).; default=no}{key:enter}-Warfarina {formmenu: 2.5; 5; 10; 160; 320; default=80} mg vo cada {formmenu: día; día de por medio; default=día}.{endformtoggle}{formtoggle: name= Otro (TA).; default=no}{key:enter}-{formparagraph: height=1; width=80}{endformtoggle}

As you can see it's a pretty large list (and let me tell you that this one is short) and I would prefer to find a way to use a formmenu with multiple choice menu that also will allow me to choose the dose and schedule of every single element that I need.

Trying to get a way to clarify this I sent some emails to @scott requesting an easier way to use colours in toggles (searching to avoid the confusion that so many toggles together create) and he told me that in the future he could help me, but no by now.

Thank you so much,

Luis

Hi @Luis_Andres_Herrera,

Here's how I would do it:

{note: preview=no}
{`treatment list`=["Amlodipino", "Captopril (TA)", "Carvedilol", "Clonidina (TA)", "Dalteparina (TA)", "Dexametasona", "Enalapril (TA)", "Enoxaparina (TA)", "Insulina Glargina (TA)", "Insulina Glulisina (TA)", "Levodopa - Carbidopa (TA)", "Losartan (TA)", "Metoprolol (TA)", "Prazocin (TA)", "Prednisolona (TA)", "Tramadol (TA)", "Valsartán (TA)", "Vasopresina", "Verapamilo (TA)", "Warfarina (TA)", "Otro (TA)"]}

{endnote: trim=right}

{note: trim=right}
{formmenu: name=treatment; multiple=yes; values={=`treatment list`}}

{endnote: trim=right}

**CURRENT TREATMENT:

{repeat: for choice in treatment; trim=right}
-{if: choice=="Amlodipino"}Amlodipino {formmenu: 5;10; default=5} mg vo cada {formmenu: 4; 6; 8; 12; 24; default=cada 12} horas.
{elseif: choice=="Captopril (TA)"}Captopril {formmenu: 12.5; 25; 50; 100; default=50} mg vo cada {formmenu: 8; 12; 24; default= 24} horas.
{elseif: choice=="Carvedilol"}Carvedilol {formmenu: 3,12;6.25;12.5; default=6.25} mg vo {formmenu: cada 6; cada 8; cada 12; cada 24; default=cada 12} horas.
{elseif: choice=="Clonidina (TA)"}Clonidina {formmenu: 75; 150; 300; default=150} ug vo {formmenu: monodosis; cada 4 horas; cada 6 horas; cada 8 horas; cada 12 horas; cada 24 horas; default=cada 24 horas}.
{elseif: choice=="Dalteparina (TA)"}Dalteparina {formmenu: 2500; 5000; 7500; default=5000} U subcutáneas cada {formmenu: 12; 24; default=} horas a las {formmenu: 18; 6 y 18; default=18} horas.
{elseif: choice=="Dexametasona"}Dexametasona {formmenu: 4; 5; 8; 12; default= } mg iv {formmenu: cada 4 horas; cada 6 horas; cada 8 horas; cada 12 horas; cada 24 horas; monodosis; default= }.
{elseif: choice=="Enalapril (TA)"}Enalapril {formmenu: 5;10;20; default=20} mg vo {formmenu: cada 12; cada 24; default=cada 24} horas.
{elseif: choice=="Enoxaparina (TA)"}Enoxaparina {formmenu: 20; 40; 60; 80; default=40} U sc cada {formmenu: 12; 24; default=24} horas a las {formmenu: 18 horas; 6 y 18 horas; default=18 horas}.
{elseif: choice=="Insulina Glargina (TA)"}Insulina Glargina {formtext: name=U Insulina Glargina; width=20} U cada {formmenu: 6; 8; 12; 24; default= 12} horas.
{elseif: choice=="Insulina Glulisina (TA)"}Insulina Glulisina {formtext: name=U Insulina Glulisina; width=20} U cada {formmenu: 6; 8; 12; 24; default=12} horas.
{elseif: choice=="Levodopa - Carbidopa (TA)"}Levodopa (100 mgr) - Carbidopa (25 mg) vo cada {formmenu: 6; 8; 12; 24; default=cada 12} horas.
{elseif: choice=="Losartan (TA)"}Losartan {formmenu: 25;50;100; default=50} mg vo cada {formmenu: 8; 12; 24; default= 24} horas.
{elseif: choice=="Metoprolol (TA)"}Metoprolol {formmenu: 25; 50; 100; default=50} mg vo cada {formmenu: 6; 8; 12; 24; default=cada 12} horas.
{elseif: choice=="Prazocin (TA)"}Prazocin {formmenu: 1; 2; default=1} mg vo cada {formmenu: 6; 8; 12; 24; default= 12} horas.
{elseif: choice=="Prednisolona (TA)"}Prednisolona {formmenu: 5;10;15; 20; 50; default=5} mg vo cada 24 horas.
{elseif: choice=="Tramadol (TA)"}Tramadol.{endformtoggle}{formtoggle: name= Trazodona (TA).; default=no}{key:enter}-Trazodona.
{elseif: choice=="Valsartán (TA)"}Valsartán {formmenu: 80; 160; 320; default=50}mg vo cada {formmenu: 6; 8; 12; 24; default=cada 12} horas.
{elseif: choice=="Vasopresina"}Vasopresina infusión iv.
{elseif: choice=="Verapamilo (TA)"}Verapamilo {formmenu: 40; 80; 120; 160; 320; default=80} mg vo cada {formmenu: 6; 8; 12; 24; default=cada 12} horas.
{elseif: choice=="Warfarina (TA)"}Warfarina {formmenu: 2.5; 5; 10; 160; 320; default=80} mg vo cada {formmenu: día; día de por medio; default=día}.
{elseif: choice=="Otro (TA)"}{formparagraph: height=1; width=80}
{endif: trim=yes}
{endrepeat}

1 Like

Wow, so amazing!

Thanks a lot!

1 Like