Appending to a text field

tbrodowski6367
tbrodowski6367 Community Member Posts: 31
I'm trying to append text to a text field and then display it on the screen.  For example numbers like 01, 23, 11 and so on or text like cat, dog, etc. based on user input.  For some reason solution evades me.  Any ideas?

Comments

  • timk
    timk Community Member Posts: 1,207 ♦ Idol ♦
    You can use  the "Change content" action to get the value from an input field (or any variable) into a textfield.

    Tim
  • tbrodowski6367
    tbrodowski6367 Community Member Posts: 31
    Hello Tim.  I tried "change content" but that would replace whatever already is in the text field.  What I want it to do is append to existing text.  For example, you start out with a text field with a word "dog" in it, then when you click a button it would add a comma and a word "cat" to it and so on so it looks like this (dog, cat,...).
  • timk
    timk Community Member Posts: 1,207 ♦ Idol ♦
    You need an extra variable to sum up the initial value of the textfield and all added values, so the text in the textfield can be replaced completely.

    I've attached an example in that you select animals with checkboxes. The selection is displayed in a textfield.

    Tim
  • tbrodowski6367
    tbrodowski6367 Community Member Posts: 31
    Thanks Tim! This is very helpful.
  • nwilliams3743
    nwilliams3743 Community Member Posts: 74
    Hey Tim,

    I noticed that for the actions of the checkbox, you had it set to var equal to on.

    Is there any difference in functionality to having this as checkbox is not empty?

    I've tested and from what I can see  it works the same, but as your experience is far greater than mine, I thought I'd ask the question.
  • timk
    timk Community Member Posts: 1,207 ♦ Idol ♦
    Hi Nick,

    good observation, the checkbox variable can have only two states, "on" (= checked) or empty (= unchecked), so "Not empty" would be the same as "Equal to on".

    Tim