Explore the community Forums Lectora Lectora Questions & Answers Maintaining Margin (or paragraph spacing) in Dynamically Filled Text Boxes?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #444144 Score: 0
    Profile photo of Laura Gillenwater
    Laura Gillenwater
    Member
    contributor
    advanced
    intermediate
    friend finder
    verified member
    advocate
    wise owl
    profile
    picture perfect
    Group Member
    14 pts
    @tecocat

    I have a text box on my quiz question pages that is used to dynamically provide feedback (via actions that stores the feedback text in a variable and then changes the contents of the text box to whatever text is stored in that variable). I’ve formatted the text box to have a margin (so that the text doesn’t bump right up against the border I have on the text box), which looks fine with the “placeholder” text that I put it in. However, when the text changes to the dynamic text, it no longer honors the margin. I also tried adding a bit of paragraph spacing to the top (to at least keep it from bumping up against the top border line), but, again, when the dynamic text comes in, it’s not respecting that setting either.

    Is there anything I can do to fix this, short of adding some kind of CSS thing or something? (I’m not conversant enough with CSS/HTML/Javascript coding to fix the problem that way.) I don’t remember having this problem with previous versions, but I may have, but in previous versions, I used a background color for the text box instead of a border, so it may have been less noticeable. But I just don’t understand why the dynamically set text won’t “obey” the text box settings (other than font size, style, and justification, which it does seem to maintain from how I set the “placeholder” text, thank goodness!).

    #444319 Score: 1
    Profile photo of John Holland
    John Holland
    Moderator
    beginner
    intermediate
    picture perfect
    friend finder
    curious george
    wise owl
    Group Member
    profile
    Trivantis Support
    verified member
    4 pts
    @jholland.6843

    Yes, text formatting like margins and paragraph spacing will get removed in a text object when you change the content. You can add an action after the content change that adjusts the styling using CSS and jQuery/javascript. I’ve added links at the bottom of this reply to some suggestions made by forum members.

    If you don’t want to use CSS, you can use Lectora to achieve the same results by having two text boxes, one nested over the other. Have the larger box have the outline border you want, then size the inner box to be smaller with space between its outer border and the outline of the larger box. Have no border on this smaller text box. Have the text in the smaller box be the text you update. The text will stay within the inner text box. The outer text box could also be a rectangle with transparent fill and an outline border of your choice.

    Styling of ChangeContent Text

    Inline variable replacement …

    Change Contents Text Box

    This post has received 1 vote up.
    #444321 Score: 0
    Profile photo of Laura Gillenwater
    Laura Gillenwater
    Member
    contributor
    advanced
    intermediate
    friend finder
    verified member
    advocate
    wise owl
    profile
    picture perfect
    Group Member
    14 pts
    @tecocat

    @jholland.6843 – LOL…great minds think alike! The final solution that you offered (nesting the text box within a rectangle with an invisible fill) is exactly the solution I came up with yesterday and ended up using.  But thanks for confirming the situation and for offering those great resources…really appreciate the time and effort! 🙂

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

You must be logged in to reply to this topic.