Copied to clipboard

Flag this post as spam?

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


  • Preetee Gangoosirdar 56 posts 257 karma points
    Apr 12, 2019 @ 10:37
    Preetee Gangoosirdar
    0

    Umbraco.CheckBoxList Prevalues commas break strings or remove part of string

    Hej there,

    I having issue with prevalues when using Umbraco.CheckBoxList data type. If my prevalue is a string containing commas "," it breaks the string into different line and comma is remove.

    enter image description here enter image description here

    Sounds like there is split being done. Is there a way to resolve this issue am using Umbraco version 7.6.3 assembly: 1.0.6361.21154 Thank you for your kind reply

  • Johannes Lantz 156 posts 839 karma points c-trib
    Apr 12, 2019 @ 11:10
    Johannes Lantz
    100

    What an Interesting behavior!

    What about using the html entity for comma?

        ,
    

    //Johannes

  • Preetee Gangoosirdar 56 posts 257 karma points
    Apr 17, 2019 @ 06:20
    Preetee Gangoosirdar
    0

    @Johannes Tak :) it works thank you very much if i set the prevalue to

    We have 2,3 kr to give
    
    I have use @Html.Raw(value.Replace("",", ","))
    

    However that might be not user friendly when inserting values with comma like this. Is there another approach i can use the commas sign itself in the prevalue I saw a bug reported https://issues.umbraco.org/issue/U4-8059

  • Johannes Lantz 156 posts 839 karma points c-trib
    Apr 17, 2019 @ 06:37
    Johannes Lantz
    0

    Hmm, shoulden't it just work with @Html.Raw() ?

    Just let me doubble check, dose this happen in the backoffice or when you try to print it in your code?

    //Johannes

  • Preetee Gangoosirdar 56 posts 257 karma points
    Apr 17, 2019 @ 06:47
    Preetee Gangoosirdar
    0

    Yes i set the prevalue in the backoffice ,

    Initially if i set the prevalue "We have 2,3kr to give" with a normal commas , this will split the string into 2 string

    I have use @Html.Raw(value.Replace("," ,","))
    

    So i went this approach i change the , to , in the prevalue , and this result to "We have 2,3kr to give" and in my code i did the following below

      @Html.Raw(value.Replace(",,","))   this works but for the user to replace all normal commas to "," , might cause misspelling and does not look great to read .
    
  • Johannes Lantz 156 posts 839 karma points c-trib
    Apr 17, 2019 @ 07:09
    Johannes Lantz
    1

    What about using a dot? (".") And then do a String.Replace ? Maybe not ideal but should be more user friendly than using ,..

  • Preetee Gangoosirdar 56 posts 257 karma points
    Apr 17, 2019 @ 08:54
    Preetee Gangoosirdar
    0

    Hi Johannes , I will propose the user to go with a ; instead of . as it is used in the prevalue string sometimes. But this is an issue with umbraco itself as i understood per related reported bug https://issues.umbraco.org/issue/U4-8059. Again thank you very much for your kind help.

Please Sign in or register to post replies

Write your reply to:

Draft