Copied to clipboard

Flag this post as spam?

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


  • Tom Martin 30 posts 72 karma points
    Apr 29, 2013 @ 14:54
    Tom Martin
    0

    Need link text in form field

    Hello

    does anyone know if it's possible to insert a hyperlink as part of a form label?

    I need my 'Accept terms & conditions' part of the checkbox label to hyperlink to the T&C page...

    Thanks

    Tom!

  • Alex Skrypnyk 6131 posts 23950 karma points MVP 7x admin c-trib
    Apr 29, 2013 @ 16:09
    Alex Skrypnyk
    0

    Hi Tom, it's unreal with standard controls.

    Thanks,

    Alex

  • Tom Martin 30 posts 72 karma points
    Apr 29, 2013 @ 16:57
    Tom Martin
    0

    Hi Alex

    what do you mean unreal? You mean impossible?

    Thanks

    Tom

  • Tom Martin 30 posts 72 karma points
    Apr 29, 2013 @ 17:09
    Tom Martin
    0

    Ok found the answer, had to create a dictionary item with the html in it, and then reference that dictionary item alias in the content field (#TermsConditions). However it was escaping the text so had to then update my custom form to @Html.Raw(f.Caption). So looks like this is not possible out of the box.

  • Damon 217 posts 287 karma points
    Jan 08, 2016 @ 13:07
    Damon
    0

    What do you mean by a dictionary item? How do you add this in Forms?

  • TheOriginal 22 posts 122 karma points
    Jan 13, 2016 @ 13:58
    TheOriginal
    0

    You could javascript, aslong as the label text will staying the same you can have it at any part of the text, where as if the text will change you could do this dynamically working for all text but the link would have to be at the end or the beginning.

    You can do it in any part of the text by using:

    $(".labelSelector").substring(textTarget).wrap(<a href="#"></a>);
    

    That should work, you can use a dynamic razor url from a media picker or anything like that by simple creating an invisible input with the value as the url variable.

  • Carlos Casalicchio 169 posts 698 karma points
    Mar 23, 2020 @ 21:38
    Carlos Casalicchio
    1

    In the Views/Partials/Forms/Form.cshtml you can simply add @Html.Raw

     @if (!string.IsNullOrEmpty(f.ToolTip))
            {
                  <span class="help-block">@Html.Raw(f.ToolTip)</span>
            }
    

    and then you can add html to the help block

    I accept the <a href='/terms-of-use/'>Terms of Use</a> and <a href="/privacy-policy/">Privacy Policy</a>
    

    Example

Please Sign in or register to post replies

Write your reply to:

Draft