Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

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.

share|improve this answer
    
See my comments to Marc, it will actually be simpler this way. –  James Love May 24 '11 at 19:33
add comment

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>");
share|improve this answer
    
Yeah I do use jQuery elsewhere in the page, I'll update my answer with more details... –  James Love May 24 '11 at 19:25
    
For this requirement, does it make sense to use two text columns instead of a link column? Meaning two text columns for each "URL": the Description and the URL. –  Marc D Anderson May 24 '11 at 19:29
    
Yeah, it might simpler, and I did consider this method. It'll mean a lot less code, too. Cheers! –  James Love May 24 '11 at 19:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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