[TextAreaCounter] 1 space will not be saved

[TextAreaCounter] 1 space will not be saved

Forge Component
Published on 2012-05-15 by Eric Oud Ammerveld (PS9.1)
2 votes
Published on 2012-05-15 by Eric Oud Ammerveld (PS9.1)

In my application I have a textbox with a counter. If I type in 1 space (no letters, just pressed the spacebar once), then the counter says I have 999 characters left, which is correct. When I go outside of the textbox (onblur) it will save the content of the textbox but it will not save that 1 space I just typed in, the counter goes back to 1000 and nothing has been saved. If I type in 2 spaces it works fine and the counter stays at 998. I also have no problems with saving 1 letter or number. It is important to know in the application if there are characters in the textbox but I'm not able to fix it.

I tried the counter in another application (with a normal save button) in a pop-up. When I press the save button it will save and close the pop-up. When I try to adjust the text I typed in (in this case 1 space) the textbox is empty, when I change it to 2 spaces it will save these two spaces and are still there when I try to adjust the text once more.

To me it seems that it is not able to save 1 space in a textbox, writing this I wonder if this has anything to do with the counter at all, but because of the counter I can see that only 1 space cannot be saved. Is this known (or normal?) behaviour? And how can I make it save 1 space?

Hi Gerrejanne,

I'm not familiar with this 'bug'.
What you could perhaps try is store the data coming from the input field as HTML encoded (I believe Outsystems has Built-in functions to do this) and on retrieving the data decode it again.
I'm also wondering whether you have this effect on all types of browsers.


If you're a bit into jQuery you could try and adopt below method, which will probably be more compatible with several device types and less 'heavyweight'.

Hi Gerrejane,
Is your DB Oracle or SQL Server? I know that in Oracle the empty string (for the OS Platform) is actually "(space)" because if you insert just "" oracle tries to insert null. I'm wondering if the behavior you are getting isn't a manifestation of that....

Hi Miguel and Eric,

Thanks to you both for the quick reply!
@ Eric: I am able to test it in IE and FF and in both browers it has the same effect.

It's an Oracle Server. When I run the query I can see that the input is " " but is saved as "".
I gues you have a point right there!