I have two Textbox properties, "Title Prefix" and "Title Suffix", that a user can make use of to customize page titles. Seems to work fine, except that on save Umbraco appears to be removing leading and trailing whitespace from those property values. So, a user can't really do a page title like this:
Viewing Home on Site.com
The prefix in that case would be "Viewing " and the suffix would be " on Site.com" (note the trailing/leading whitespace). Instead, a user gets this:
ViewingHomeon Site.com
Is this expected behavior? A bug? Is there anyway to force whitespace to be retained?
If you wanted to give them the option to have a space between the prefix or suffix, you could get them to put in a special character (e.g. ~) at the end of the prefix or beginning of the suffix.
Then in the template replace the character ~ with a space.
This is a bit of a hack, so I would use Chriztian's solution unless you wanted to give the editor the option
Textbox Property Trims Leading/Trailing Whitespace?
I have two Textbox properties, "Title Prefix" and "Title Suffix", that a user can make use of to customize page titles. Seems to work fine, except that on save Umbraco appears to be removing leading and trailing whitespace from those property values. So, a user can't really do a page title like this:
The prefix in that case would be "Viewing " and the suffix would be " on Site.com" (note the trailing/leading whitespace). Instead, a user gets this:
Is this expected behavior? A bug? Is there anyway to force whitespace to be retained?
Umbraco 7.1.8.
Hi Nicholas
Hmm, I would say it's a bug unless it's because there is no space after "Viewing" so it in the textbox says "Viewing " for instance.
/Jan
Hi Nicholas,
How are you displaying this in the template? Are you not able to tackle the problem there?
I've done this from time to time and basically just done this:
/Chriztian
Just to add to Chriztians solution...
If you wanted to give them the option to have a space between the prefix or suffix, you could get them to put in a special character (e.g. ~) at the end of the prefix or beginning of the suffix.
Then in the template replace the character ~ with a space.
This is a bit of a hack, so I would use Chriztian's solution unless you wanted to give the editor the option
Dave
Thanks for the opinions and ideas for workarounds. I have reported an issue for this: http://issues.umbraco.org/issue/U4-5788
It's surprising that nobody else seems to have encountered this (or at least not reported it). As a temporary workaround, I am doing this:
Not ideal, as it assumes the user wants spaces (they may or may not), but it'll do for now.
is working on a reply...