Repeat textfield input

I use Text Blaze to aid in answering support requests from customers (live chat, support tickets, and Facebook comments) for an antivirus company. I run into situations where I need to enter identical custom input multiple times in the same response & would love the option to have the text from one custom input automatically populate into another.

For example: in the script below, both instances of formtext would use the same exact input:

Dear user,
I'm sorry you're having trouble reaching {formtext: name=website}. I checked our logs and this site isn't one that our software blocked. But I'd be happy to see if I can help you determine what could be going wrong. Can you describe what you see when you try to visit {formtext: name=website}?

Hi @Deborah_Lewis, welcome to the forum.

Here's how you do that:

{formtext: name=website; default=gmail.com}
{=website}

1 Like

Thank you! Thank you!

& here I thought I had TextBlaze all figured out. This is a huge time saver. I appreciate it very much!

Hi Deborah, in addition to Cedric's approach, the example you posted in your initial question will actually work as-is.

Those two {formtext}'s will be linked together:

Dear user,
I'm sorry you're having trouble reaching {formtext: name=website}. I checked our logs and this site isn't one that our software blocked. But I'd be happy to see if I can help you determine what could be going wrong. Can you describe what you see when you try to visit {formtext: name=website}?

Careful @Deborah_Lewis, you're about to be drawn into the Text Blaze geekdom rabbit hole. And once you're in there, there's no coming back. Just ask @George_Marinos lol.

Joking aside. The same principle applies to other form commands. Have a look:

{formtext: name=textfield; default=Some text}
{=textfield}

{formparagraph: name=paragraphfield; default=A paragraph of text}
{=paragraphfield}

{formmenu: name=menufield; option a; option b; option c}
{=menufield}

{formdate: YYYY-MM-DD; name=datefield}
{=datefield}

Note that if you use the name setting of a formtoggle command it will return the status of that formtoggle i.e. "yes" or "no":

{formtoggle: name=togglefield}This is the text{endformtoggle}
{=togglefield}

Nice illustrations of the use of fields Cedric. Very useful as a guide.

Similar simple illustration of the use of [lists] to expand the power of these fields will be a godsend to beginners like myself who are finding an ever expanding usefulness of TB

George

1 Like

Here's another example based on what @George_Marinos mentioned:

{options=["option1", "option2", "option3"]}
{formmenu: name=menu; values={=options}}

What we're doing here is:

  • creating a list called "options" - you can recognize that this is a list by the square brackets. Each option needs to be in quotation marks, otherwise it will be considered a variable name (more on that later)
  • creating a formmenu command with the name "menu" and using the items in the list "options" as values in the formmenu command.

In other words, it's the same thing as doing this:

{formmenu: name=menu; option1; option2; option3}

There are different reasons why you would want to use one version over the other. If it's a relatively simple snippet, the second version will be perfectly fine. But if you're planning on regularly adding ites to the formmenu, you might want to go with the first version as it makes things easier to understand at a glance.

On a final note, I mentioned earlier how each item in a list needs to be surrounded by quotation marks, otherwise it will be interpreted as a variable name.

Here's what I mean. Try tilling in the three formtext fields and notice how it affects the formmenu command.

{formtext: name=option1}
{formtext: name=option2}
{formtext: name=option3}

{options=[option1, option2, option3]}
{formmenu: name=menu; values={=options}}

So now, "option1", "option2", "option3" are variables in the list. Each on is getting its contents from the respective formtext command.

Here's a practical example of how you might want to use this in a scenario where you have a number of set options, AND want an "other" customizable option. Let's also add a multiple setting to make it possible to choose multiple options in the dropdown menu.

Other: {formtext: name=other}

{options=["This is the first option", "This is the second option", "This is the third option", other]}
{formmenu: name=menu; multiple=yes; values={=options}}

Mana from heaven.

More please

1 Like