Explore the community Forums Lectora Lectora Questions & Answers Formatting text in a text box

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #298670 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Hello

    I have a textbox. The contents of the textbox are determined by setting a variable during a Change Content action. The text is displayed correctly. However, I would like part (or all) of the text to be in BOLD (or one of the other html formatting commands).

    I do not seem to be able to do this. Any html command that I insert is interpreted as text e.g. it appears as <B>. Is there some way that I can control all or part of the formatting of text displayed in the text box?

    I have looked in the help file but could not discover an answer for this (maybe I did not use the magic words during my search).

    Thank you

    Andrew

    #298676 Score: 0
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    333 pts
    @ssneg

    No, that’s just not a feature in Lectora. You can set a whole textbox (formatted the way you want) to a variable value but not have partial formatting, unfortunately. If you REALLY want it, you can use JavaScript to add formatting to the textbox.

    #298678 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Thank you. I will have to find another solution. The only way I seem to be able to set up the text box to receive formatted text (e.g. all bold) is to “initialise” it with some text in the right format and when I send the variable, the entire box is filled with the same thing e.g. all text is bold. Is there some other way to set the text box format?

    On a related question, is it possible to generate text boxes programmatically i.e. have Lectora produce a text box through an action (and presumably format it also, to the extent that it is possible)?

    #298688 Score: 1
    Profile photo of Sergey Snegirev
    Sergey Snegirev
    Member
    contributor
    intermediate
    advanced
    friend finder
    lab member
    junior moderator
    advocate
    LUC16
    LUC16 Attendee
    wise owl
    333 pts
    @ssneg

    The only way I seem to be able to set up the text box to receive formatted text (e.g. all bold) is to “initialise” it with some text in the right format and when I send the variable, the entire box is filled with the same thing e.g. all text is bold. Is there some other way to set the text box format?

    This is the way to do it, yes.

    On a related question, is it possible to generate text boxes programmatically i.e. have Lectora produce a text box through an action (and presumably format it also, to the extent that it is possible)?

    No, you cannot create objects via actions. At the end of the day, Lectora is a rapid authoring tool, not a HTML development IDE.

    This post has received 1 vote up.
    #298706 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Thank you. I understand that it is a rapid authoring tool but it is sophisticated in many ways and we get to rely on that sophistication and the convenience of the system. For some reason that I do not understand, text manipulation through embedded strings seems to be problematic with tools like articulate and lectora (the ones I know best – very badly actually but I am learning) yet text manipulation can be so useful in giving feedback to learners (especially colour and font styles).

    cheers

    #298788 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    192 pts
    @Klaatu

    Hi,  Andrew. Did you test your contents using preview in browser? I attached a sample question that uses html formatting in the feedback. It works fine when previewed in a browser, however, it shows the html tags in lectora’s preview or run mode.

    Can you attach an example of what you have built?

    Darrel

    #298789 Score: 0
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    192 pts
    @Klaatu

    Sorry, forgot I had to zip it.

    Attachments:
    1. HTML_Tags.zip
    #298791 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Thank you so much Darrel. That’s very interesting. Actually, I did try it in a browser served by an apache server. What I am actually building is a text variable and displaying it in a text block – not an alert box like the one which provides feedback in a quiz (like the one you created). That still does not work – even in a browser.

    Hmm funny that the system appears to be inconsistent.

     

    #298792 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Darrel, here is your file which shows what I want to do. Does not work 🙁

    #298794 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Woops… here is the zip file.

    Attachments:
    1. HTML-Tags.zip
    #298800 Score: 1
    Profile photo of Darrel Somoza
    Darrel Somoza
    Member
    contributor
    friend finder
    beginner
    intermediate
    junior moderator
    advanced
    wise owl
    curious george
    profile
    192 pts
    @Klaatu

    I know this is not exactly what you are looking for but you can dynamically change the contents in a text box, with html formatting, using javaScript (see attached). There could be a work around for what you are trying to ultimately accomplish using this method.

    injecting styling code into a Lectora variable does not seem possible.

    You could build the whole interaction in JavaScript/CSS and embed it into a Lecotra page.

    I’ll try more tomorrow.

    This post has received 1 vote up.
    Attachments:
    1. text-change.zip
    #298812 Score: 0
    Profile photo of Andrew Lian
    Andrew Lian
    Member
    beginner
    intermediate
    friend finder
    advanced
    contributor
    wise owl
    curious george
    profile
    12 pts
    @mlapl1

    Thank you Darrel 🙂 – That is clearly a good possibility – in many contexts. In the application I have in mind, lectora would have to read the display string from a php script and then do some work to transform some of the words into hotwords (more JS – making it more difficult to manage inside Lectora which is really not equipped for long external scripts) and then communicate clicks etc. back to the script etc… It may be simpler and more effective to just embed the php script inside lectora (i-frame style) to keep a uniform appearance – then, in due course, the script would have to report results back to lectora for record-keeping purposes. Not impossible especially with lectora’s built-in ability to post etc…

    Any further ideas gratefully accepted. I very much appreciate the time that you are spending to help. Thank you! (klaatu barada nikto) 🙂

    #298897 Score: 0
    Profile photo of Vicki
    Vicki
    Member
    beginner
    intermediate
    friend finder
    curious george
    wise owl
    contributor
    picture perfect
    4 pts
    @Vicki

    Without knowing how many possible outcomes of your change contents actions there are, if only a few, you could add a text box with each variation of wording. Each text box would be initially hidden and use an action “on page show, show textbox X if variable =Y” It is a simplistic approach that is a bit tedious, but would allow you the versatility of formatting the text in each box uniquely.

    Vicki

     

    #300206 Score: 1
    Profile photo of Math Notermans
    Math Notermans
    Member
    contributor
    intermediate
    advanced
    friend finder
    junior moderator
    advocate
    LUC16 Attendee
    LUC16
    wise owl
    curious george
    106 pts
    @mnotermans5114

    Using GSAP SplitText you could do what you want.

    Steps to get it done would be:

    – Get the source text from a textfield in Lectora
    – Split the text in characters, words and/or lines- Each split element gets its own class.
    – So when splitting check for the content you want formatted
    – Set that content to another class
    – Then all shows exactly as you want it.

    This post has received 1 vote up.
Viewing 14 posts - 1 through 14 (of 14 total)

You must be logged in to reply to this topic.