Deselect default formtoggle

Wondering if there's a way to deselect the default formtoggle when another toggle is selected.

Thanks so much for any help!

I am not sure I fully understand, could you explain the use case a bit more?

You could combine a {formtoggle} with an {if} command to get something like what I think are looking for:

{formtoggle: name=Carnivore}You eat meat.{endformtoggle}


{if: not carnivore}You don't love eat meat{endif}

Essentially going for something to keep 1 potato default, but if I select 2 potato I'd like 1 potato to de-select.

{formtoggle: name=1 potato; default=yes}

{formtoggle: name=2 potato} If selected, un-toggle 1 potato.

So it's not possible to do that currently, unfortunately.

It would be helpful to understand the use case. Maybe a {formmenu} combined with {if} might be a more idiomatic way to achieve what you are looking for in Text Blaze. Or maybe there is a feature gap we need to address.

Hey Peter. I found a way to make this kind of work. It uses the first select as the trigger for both choices. 1 is enabled by default and deselecting it sets 2 to yes. To set 1 again and deselect 2, you'd have to select 1. Not sure how this would work with more choices but I hope that helps.

{formtoggle: name=one; default=yes}1 Potato{endformtoggle}
{formtoggle: name=two; default=no}2 Potatoes{endformtoggle}
{if: one==no}{two=yes}{else}{two=no}{endif}

Thanks for sharing Justin!

Again, would love to understand the use cases for something like this better to see if we have a feature gap we need to fill. Would it be possible to post a real life simplified example of the workflow issue you are tackling?

So I was able to get closer to what I'm looking for with multiple {if} statements. The only catch with this implementation is you have to select the alternate option twice for it to select.

I am also having trouble with naming and I can't seem to find what I need to do. My actual toggles have names with spaces. So when I use them in the if statements, they are unrecognized. Is there a way to reference the name if it has spaces?

{formtoggle: name=one; default=yes}1 Potato{endformtoggle}
{formtoggle: name=two; default=no}2 Potatoes{endformtoggle}
{formtoggle: name=three; default=no}3 Potatoes{endformtoggle}

{if: two==yes}{one=no}{three=no}{endif}
{if: one==yes}{two=no}{three=no}{endif}
{if: three==yes}{one=no}{two=no}{endif}

Example of toggle with a space:
{formtoggle: name=This one; default=yes}This option.{endformtoggle}
{formtoggle: name=This other one}This is the alternate option.{endformtoggle}

{if: This one==yes}{This other one=no}{endif}
{if: This other one==yes}{This one=no}{endif}

We're adding a syntax to allow you to refer to any name in formulas even if they include characters that are normally invalid in formulas.

Basically you will be able to enclose any name in back-ticks to reference it as a form variable. This should be in the next release.

Here is an example:

Price: {formtext: name=Item Price ($); default=100}
2X price is: {=`Item Price ($)` * 2}

(Note this syntax is not yet released in the extension, so it won't work if you try to use it in practice at the moment)

Since this syntax isn't out yet, please let us know if you have any feedback on it.

This is perfect! Exactly what I'm going for. This will come in handy for a lot of different things. Thank you!

I was playing around with this new functionality and can't seem to figure out how to declare the name contained in the back-ticks as no or yes.

{`this one`=no}

The snippet insert seems to be removing the back-ticks, but I've typed {this one=no} with ticks around "this one".

[You need to put a backslash before the ` in the forum software as ` is used for applying code styling in the forum software. I've updated your snippet above to do that.]

In the betas of this feature, we don't currently support assigning to a `longer name` using the formula syntax. The thinking behind this is that longer names will probably be coming exclusively from {form*} commands. Though you may need to reference them in formulas, you won't need to assign to them.

It sounds like you're running into a scenario where you in fact do need to do this. Could you outline it so I understand the need.

Thanks for the clarification.

Essentially we have a variety of snippets that have replies that are contained in formtoggles.

Depending on the issue/resolution, the user selects the toggle that best fits their reply. Most often it's the first option which is set as default. But when the output is changed to option 2 or 3 or any of the other form toggles, I'm looking to set toggle one from =yes to =no. To prevent sending multiple replies in one message by accident and to reduce clicks.

Thanks Peter, that's helpful.

I think it makes sense to extend the `...` syntax to the left-hand side of formula assignments. We'll try to add it.

Tested this with the most recent update and everything works great with our multi-word names.

Only catch is having to click the alternate toggle option twice for it to select. I'm sure this is a result of the implementation of the {if} statements.

1 Like

Here's how I want to use it ...

I am an online teacher. I teach world languages and I have to give student feedback on their speaking ability. I use a rubric where I give them feedback on Vocabulary, Grammar, Fluency and Pronunciation.

Each of those elements has a rubric with 4 scales.

Here's what I have now for one of those categories.

{formtoggle: name=1Vocabulary; default=no}Vocabulary is inadequate for most basic aspects of the task / may show evidence of using trnslator.
{endformtoggle}{formtoggle: name=2Vocabulary; default=no}Vocabulary is not extensive enough for the task. Frequent use of dictionary words or very repetitive
{endformtoggle}{formtoggle: name=3Vocabulary; default=no}Vocabulary is usually accurate; may have dictionary words rather than words from recent unit.
{endformtoggle}{formtoggle: name=4Vocabulary; default=yes}Vocabulary is generally accurate and appropriate; minor errors may occur.

{endformtoggle}Vocabulary: {formtext: name=Vocab; default=6}/6

I have defaulted the 4th option, but I would love to be able to select the 2nd one and have the 4th one unselect (like using radio buttons).


Answered my own question. I think a formmenu command here is a better option.


I was able to accomplish this using separate {if} statements. The only hangup I ran into was when you click one of the alternate options it must be clicked twice to activate the toggle.

{formtoggle: name=one; default=yes}1 Potato{endformtoggle}

{formtoggle: name=two; default=no}2 Potatoes{endformtoggle}

{formtoggle: name=three; default=no}3 Potatoes{endformtoggle}

{if: two==yes}{one=no}{three=no}{endif}

{if: one==yes}{two=no}{three=no}{endif}

{if: three==yes}{one=no}{two=no}{endif}

1 Like

This would work for me, but after working on a feedback form I was creating, I found that the formmenu works a little better, but I still think there would be times when a "radio button" like toggle could be useful. I will remember you have this one working, though, and will use it in the future if I have a need for it.