Explore the community Forums Lectora Lectora Questions & Answers Appending to a text field

Tagged: , , ,

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #328326 Score: 0
    Profile photo of Tom Brodowski
    Tom Brodowski
    Member
    beginner
    intermediate
    friend finder
    curious george
    contributor
    wise owl
    picture perfect
    LUC17 Attendee
    3 pts
    @tbrodowski6367

    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?

    #328338 Score: 0
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    309 pts
    @timk

    You can use  the “Change content” action to get the value from an input field (or any variable) into a textfield.

    Tim

    #328343 Score: 0
    Profile photo of Tom Brodowski
    Tom Brodowski
    Member
    beginner
    intermediate
    friend finder
    curious george
    contributor
    wise owl
    picture perfect
    LUC17 Attendee
    3 pts
    @tbrodowski6367

    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,…).

    #328354 Score: 0
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    309 pts
    @timk

    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

    #328356 Score: 0
    Profile photo of Tom Brodowski
    Tom Brodowski
    Member
    beginner
    intermediate
    friend finder
    curious george
    contributor
    wise owl
    picture perfect
    LUC17 Attendee
    3 pts
    @tbrodowski6367

    Thanks Tim! This is very helpful.

    #328603 Score: 0
    Profile photo of Nick Williams
    Nick Williams
    Member
    friend finder
    beginner
    intermediate
    contributor
    wise owl
    curious george
    advanced
    10 pts
    @nwilliams3743

    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.

    #328610 Score: 0
    Profile photo of Tim K
    Tim K
    Member
    contributor
    beginner
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    wise owl
    curious george
    Group Member
    309 pts
    @timk

    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

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.