Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9116471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:40:50+00:00 2026-06-17T04:40:50+00:00

I seem to be having issues with leading/trailing spaces in textareas! If the last

  • 0

I seem to be having issues with leading/trailing spaces in textareas!

If the last user has typed values into a textarea with leading/trailing spaces across multiple lines, they all disappear with exception to one space in the beginning & end.

Example:
If the textbox had the following lines: (quotes present only to help illustrate spaces)

"   3.0"
"  2.2  "
"0.3   "

it would be saved in the backend as

"<textarea id=... >   3.0/n  2.2  /n0.3   </textarea>"

My template (for this part) is fairly straightforward (entire template, not as easy…):
${label} ${textField}

When I load up the values again, I notice getTextField() is properly getting the desired string, quoted earlier… But when I look at the html page it’s showing

" 3.0"
"2.2"
"0.3 "

And of course when “View Sourcing” it doesn’t have the string seen in getTextField()

What I’ve tried:

  • Ensure the backend has setWhitespaceStripping(false); set
  • Adding the <#ftl strip_whitespace=false>
  • Adding the <#nl> on the same line as ${textField}

No matter what I’ve tried, I’m not having luck keeping the spaces after the interpolation.
Any help would be very appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:40:52+00:00Added an answer on June 17, 2026 at 4:40 am

    Maybe you are inside a <#compress>...</#compress> (or <@compress>...</@compress>) block. Those filter the whole output on runtime and reduce whitespace regardless where it comes from. I recommend not using this directive. It makes the output somewhat smaller, but it has runtime overhead, and can corrupt output in cases like this.

    FreeMarker interpolations don’t remove whitespace from the inserted value, or change the value in any way. Except, if you are lexically inside an <#escape ...>....</#escape>, block, that will be automatically applied. But it’s unlikely that you have an escaping expression that corrupts whitespace. But to be sure., you can check if there’s any <#escape ...> in the same template file (no need to check elsewhere, as it’s not a runtime directive).

    strip_whitespace and #nt are only removing white-space during parsing (that’s before execution), so they are unrelated.

    You can also check if the whitespace is still there in the inserted value before inserting like this:

    ${textField?replace(" ", "[S]")?replace("\n", "[N]")?replace("\t", "[T]")}
    

    If you find that they were already removed that probably means that they were already removed before the value was put into the data-model. So then if wasn’t FreeMarker.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I seem to be having issues. I have a query string that has values
Seem to be having some issues storing the current date in a core data
I'm having trouble getting regular expressions with leading / trailing $'s to match in
I seem to be having some issues with a Filestream in C#. I am
I seem to be having scope issues with using addEventListener inside of an immediate
I seem to be having the same problem that everyone has with Struts2 and
I seem to be having issues accessing my cpanel from work and so I'm
I seem to be having some issues with my result sets I have named
I seem to be having issues replicating the iOS png optimizations that xcode makes.
I seem to be having issues with using find() with the STL map on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.