Lookup field links open in modal form


  • List X has the setting "Launch forms in a dialog? = NO" . Within listX this works perfect.

    List Y has a lookup field to the ID of list X.

    When click the hyperlink on the "ID:listX" field in the "allitems.aspx" of listY the dispform for list X appears in a modal dialog form.
    Problem here is when they open another item from this dispform it apears in a modal form within the modal form. When a user then tries to open an attachment, a red error cross with the title "dialog" opens in the background modal form.

    Tuesday, April 03, 2012 12:01 PM


  • Hi,

    If you want to open a lookup field in a full page mode, you should edit the xslt view using SharePoint Designer.

    By default, Lookup fields are formatted by SharePoint before even getting passed into the xsl, so that xsl:value-of will output a whole block of HTML, including the surrounding <a> tag to /_laytouts/listform.aspx.   There have the raw value available, in a form that looks like "id;#value", and that raw value can be found in the same row data xml as the formatted value, with a . appended to the attribute name. For example, if your lookup field is called "IDofListX", its formatted value is in the attribute "@IDofListX", and the raw value in the attribute "@IDofListX."

    You can delete the orginal "IDofListX" in the xslt and then drag IDofListX. to the view

    To get just the raw value, you need to do two things - add a . to the name of the attribute, and strip off the id;# prefix. The following bit of xsl should do that:

    <xsl:value-of select="substring-after($thisNode/@*[name()=concat(current()/@Name,'.')], '#')"/>

    In order to redirect the display form of the Listx when click the lookup filed, you should add <a> tag to the xsl:

    <a href="http://vxmc2170345/Lists/ListX/DispForm.aspx?ID={substring-after($thisNode/@*[name()=concat(current()/@Name,'.')], '#')}"><xsl:value-of select="substring-after($thisNode/@*[name()=concat(current()/@Name,'.')], '#')"/></a>.

    Or you can use :

    <a href="http://vxmc2170345/Lists/facilty/DispForm.aspx?ID={substring-after($thisNode/@IDofListX., '#')}">
        <xsl:value-of select="substring-after($thisNode/@IDofListX. , '#')"/> </a>

    Xue-mei Chang

    TechNet Community Support

    • Marked as answer by Brecht DB Friday, April 06, 2012 9:33 AM
    Thursday, April 05, 2012 5:41 AM