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

On any list in SharePoint 2010, when you open the details view for a list item, you get presented with the display form.

If the details view for a list item contains a lookup field, it is displayed as a hyper link.

When you click this hyper link it opens in a new window.

Is there anyway to instead of opening in a new window, rather open another pop up, or even reloading the original popup?

This would make SharePoint seem more like an application rather than a web site.

Thanks in advance.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

You can use jQuery to change the behavior. This is based off something I did 2007, but the same should hold true in 2010. It appends a target=blank attribute to any a href that ends in .msi. You'd just need to change the selector to the proper attribute for the lookup field.

<script type="text/javascript" src="/Resources/jquery.js"></script>
<script type ="text/javascript">
 $(document).ready(function(){
   $("a[href$='.msi']").attr("target", "_self"); 
 });
</script>
share|improve this answer
    
Nice one! I don't have jquery in this solution, but I can write the js, and just edit the disp form. thanks for the heads up! –  JL01 Apr 14 '11 at 17:28
    
I think I misinterpreted your question, the target=blank will make it open in a new tab which is what is happening now. With the jQuery/JavaScript, you could do something to make it open in a modal window, which I think involves changing the class of the a href. –  PirateEric Apr 14 '11 at 17:48
    
Sure, target = "_self" did the trick :) hardest part is finding an insert point for the script. –  JL01 Apr 14 '11 at 19:11
    
Ok, great to hear! –  PirateEric Apr 14 '11 at 19:13
add comment

The preferred approach to implementing this would be to use a custom Rendering Template.

Rendering Templates are ASCX files in the ControlTemplates folder which define how SharePoint forms are displayed in both display and edit. There are high level templates 'form' and very low level templates like 'textbox'.

For multi lookup fields there is the template 'MultipleLookupField'. You can replace this template with your own. The single lookup field does not use rendering templates and cannot be replaced using this approach directly. Instead, if you have control of the list template, you can bind the list template to a custom form rendering template (like 'ListForm') and build it out from the ground up. In effect you will need to copy over all the default templates like ListForm, ListFieldIterator, CompositeField and FormField. This would allow you to change the way a lookup field is rendered by implementing the display of the field yourself. This is a medium level investment which is totally supported.

Next, you can try and do some JQuery trickery. Works too, but it is not supportable since you are binding against non-standardized HTML structures which could change in a service pack.

To learn more about rendering templates open the DefaultTemplates.ascx in the CONTROLTEMPLATES folder. There is little information on MSDN though, but some relevant topics can be found.

Wouter

share|improve this answer
    
Wouter, your solution would take 2 lifetimes to learn. I'm sure it is great when it works, or the 5 minute JS hack I just implemented works too. I don't give a rats, if its supported or not, and don't have the time to invest months in learning how to do things the MS supported way. Having said that you should write a book, because if you can explain this magic, so that regular morals can understand it, then maybe people like me would be more interested in doing things the supported way. –  JL01 Apr 15 '11 at 19:19
    
@JL01 I agree that the "MS supported way" is harder than it should be. However it is worth noting @Wouter's point - a future update could make the jQuery solution break while the rendering template won't. You may be in a situation with users breathing down your neck demanding you fix their broken SharePoint sites ASAP! Unlikely (especially if your JavaScript is carefully written) but possible. –  Alex Angas May 17 '11 at 4:15
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.