Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mts 2 posts 22 karma points
    Mar 28, 2024 @ 12:01
    mts
    0

    Umbraco Forms and formatting magic string

    Hello,

    I'm following this document to format magic strings with truncate filter: https://docs.umbraco.com/umbraco-forms/developer/magic-strings

    I would like to understand if there is way to leave out the three dots (...) that are added to the end of a truncated strings.

    @field= "abcdefghijklm"
    
    [@field | truncate: 10]
    
    result: abcdefghij...
    expected result: abcdefghij
    
  • Marc Goodson 2157 posts 14435 karma points MVP 10x c-trib
    Mar 28, 2024 @ 22:59
    Marc Goodson
    0

    Hi mts

    Yes, I think it depends on the version of Umbraco Forms, but I think there the truncate angularJS implementation is shared with the Umbraco core...

    https://github.com/umbraco/Umbraco-CMS/blob/fdea8c28c89c62bf33272e67b3d7770ff2becf9f/src/Umbraco.Web.UI.Client/src/common/filters/truncate.filter.js#L3

    So it feels like it's possible to set the 'tail', to be an empty string... So my guess is something like this:

    [@field | truncate:false:10]

    Regards

    Marc

  • mts 2 posts 22 karma points
    Apr 03, 2024 @ 06:42
    mts
    0

    Hi Marc,

    Thank you for your help!

    I tried different ways to get it work but no luck so far. Result is always that a) field is not truncated or b) field is truncated and three dots follow.

    I'm unable to check Forms version but can ask for it.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies