4

I am not able to update the url of a external url field. Can anyone suggest what I am missing here?

Here is the code I am using:

@Html.SiteEditField(Model.Component, Model.Component.Fields["Link"].EmbeddedValues[0]["ExternalLink"])
        <a href="@Model.Component.Fields["Link"].EmbeddedValues[0]["ExternalLink"].Value" class="learn-more">@Html.SiteEditField(Model.Component, Model.Component.Fields["Link"].EmbeddedValues[0]["LinkText"])@Model.Component.Fields["Link"].EmbeddedValues[0]["LinkText"].Value</a>

Where "ExternalLink" is of type external url inside linked component "Link". Yes, I am able to update text inside url which is "LinkText" inside linked component "Link".

Below is the markup generated on the page:

<!-- Start Component Field: {"XPath":"tcm:Content/custom:HomePageWidget/custom:Link[1]/custom:ExternalLink[1]"} -->
        <a href="/Services/" class="learn-more"><!-- Start Component Field: {"XPath":"tcm:Content/custom:HomePageWidget/custom:Link[1]/custom:LinkText[1]"} -->Find Out How</a>

Thanks. Mukesh

1 Answer 1

3

This is because you're missing a container element for the <a> element.

Add a <div> element around your hyperlink like this:

<div>
<!-- Start Component Field: {"XPath":"tcm:Content/custom:HomePageWidget/custom:Link[1]/custom:ExternalLink[1]"} -->
<a href="/Services/" class="learn-more"><!-- Start Component Field: {"XPath":"tcm:Content/custom:HomePageWidget/custom:Link[1]/custom:LinkText[1]"} -->Find Out How</a>
</div>

Also check out these answers/posts:

  1. https://tridion.stackexchange.com/a/5057/73
  2. http://www.tridiondeveloper.com/having-fun-with-experience-manager
1
  • Thanks Albert, Your suggestion solved my problem by inserting a div tag around. Aug 13, 2014 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.