Question

I'm making a Page Layout in SharePoint Designer 2010.

I have, as part of the content type for this Page Layout, a field of type Hyperlink.

I want to use the "Description" and actual URL stored in this field in separate and different ways.

If I use this:

<SharePoint:FieldValue FieldName="LinkTest" runat="server"></SharePoint:FieldValue>

Then I still get the full <a href="... rendered.

What I want is to be able to render just the http://... or the Description for use.

Update/Details:

I'm using jQuery UI tabs to render some tabs. The tabs will be defined by the user entering in URLs into 3 fields, one field for each tab. Each tab contains an iframe, the url to which is defined in the field associated with this tab. This works great with simple Text fields, but the "names" of the tabs are static. I'd like to use the Description of the URL as the name of the tab, and the URL of the URL field as the src for the iframe.

Was it helpful?

Solution

Another possible solution is to just setup two text field instead of using the url field. I'm not sure if that would work for what you described, though.

OTHER TIPS

You could certainly parse it out with script. It sort of depends on what "use the 'Description' and actual URL stored in this field in separate and different ways" means.

With jQuery, you could get the href and replace the link with that text. Something like this (untested):

var theLink = $("a[Title='LinkTest']");
$(theLink).replaceWith("<span>" + $(theLink).attr("href") + "</span>");
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top