Toggle cannot be linked

Toggle cannot be linked.

I wrote the following code to set the default value of Luxury Item to "yes" when the
toggle is checked for smoking or alchol, but it does not work.

{smk="no"}{formtoggle: name=smoking; default=no}{smk="yes"}{endformtoggle}
{alc="no"}{formtoggle: name=alchol; default=no}{alc="yes"}{endformtoggle}
{luxury_item="no"}{if: smk="yes" or alc="yes"}{luxury_item="yes"}{endif}
{formtoggle: name=[Luxury Item]; default={=luxury_item}}{endformtoggle}

Translated with DeepL.com (free version)

Hi @Naritatsu_Saito,

Setting luxury_item as the default value will work the first time the snippet is rendered. If you want to change it dynamically, you’ll need to give toggle the same name as that of the variable. Therefore, when you’re modifying the value of luxury_item, it’s important to name the luxury item toggle as luxury_item as well.

{smk="no"}{formtoggle: name=smoking; default=no}{smk="yes"}{endformtoggle}
{alc="no"}{formtoggle: name=alchol; default=no}{alc="yes"}{endformtoggle}
{luxury_item="no"}{if: smk="yes" or alc="yes"}{luxury_item="yes"}{endif}
{formtoggle: name=luxury_item; default=}[Luxury item]{endformtoggle}

Thanks, I think I've solved the problem...but I want to display the toggles in Japanese. Because I will be typing this in while explaining it to the patient.

It's difficult because Text Blaze doesn't allow me to give variables in Japanese.

I tried the following, using the variable "l" to control the value of Luxury Item. Then, I set "l" to white and hide it.

{smk="no"}{formtoggle: name=ε–«η…™; default=no}{smk="yes"}{l=yes}{endformtoggle}{alc="no"}{formtoggle: name=ι£²ι…’; default=no}{alc="yes"}{l=yes}{endformtoggle}
{formtoggle: name=l}{endformtoggle}γ€ε—œε₯½ε“γ€‘

You can use Japanese in variable names using backticks as {`<variable_name>`=yes}.

1 Like

Thanks, but in toggle name, backticks does not work.

{formtoggle: name=`<variable_name>`; default=}{endformtoggle}

Inside the form toggle, you can use Japanese variable names directly, but in the equation, you need to enclose them in backticks.

Thanks, @Ashwin_Mittal1
I can use variables in Japanese in the Toggle, but it doesn't seem to take over the settings.

{smk="no"}{formtoggle: name=smoking; default=no}{smk="yes"}{endformtoggle}
{alc="no"}{formtoggle: name=alchol; default=no}{alc="yes"}{endformtoggle}
{luxury_item="no"}{if: smk="yes" or alc="yes"}{`<ε—œε₯½ε“>`=yes}{endif}
{=`<ε—œε₯½ε“>`}
{formtoggle: name=ε—œε₯½ε“; default=}{endformtoggle}

Please try the snippet below. You don't have to put < or >, that was just for illustration.

{smk="no"}{formtoggle: name=smoking; default=no}{smk="yes"}{endformtoggle} {alc="no"}{formtoggle: name=alchol; default=no}{alc="yes"}{endformtoggle} {luxury_item="no"}{if: smk="yes" or alc="yes"}{`ε—œε₯½ε“`=yes}{endif} {formtoggle: name=ε—œε₯½ε“; default=no}{endformtoggle}

@Ashwin_Mittal1
Thank you very much, It works.

1 Like