Copied to clipboard

Flag this post as spam?

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


  • Kate 267 posts 610 karma points
    Mar 18, 2016 @ 19:30
    Kate
    0

    How to trim a phonenumber?

    Hi

    I have a text-field where the user kan enter a phonenumber. They want it displayed like this "4040 5050". in the code it looks like this:

    <a href="tel:@Model.Content.GetPropertyValue("phone")">@Model.Content.GetPropertyValue("phone")</a>
    

    But it gives me a error when i check the site ind https://validator.w3.org

    Is there a way I can trim the phonenumber so there isn't any space between the numbers?

    /Kate

    I found the answer here: https://our.umbraco.org/forum/developers/razor/49840-remove-spaces

  • Aristotelis Pitaridis 84 posts 402 karma points
    Mar 18, 2016 @ 20:14
    Aristotelis Pitaridis
    101

    Try the following:

    <a href="tel:@Model.Content.GetPropertyValue("phone").Replace(" ", "")">@Model.Content.GetPropertyValue("phone").Replace(" ", "")</a>
    
  • Kate 267 posts 610 karma points
    Mar 18, 2016 @ 21:04
    Kate
    1

    Hi Thanks, It works perfectly :-)

  • 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