SharePoint2k7:自定义列表EditForm令人讨厌的字段标签,如何删除?

时间:2012-05-05 02:06:12

标签: sharepoint sharepoint-2007 customization

我在TST和PRD环境之间的SharePoint 2007上遇到了一些“奇怪”的差异。我正在定制一个列表的EditForm,我注意到我在TST上创建的新表单显示如下: Correct display format

这是我想要的风格。但是,当我在PRD上执行完全相同的操作时,这就是我所得到的,请注意相同两个字段周围的额外表单字段标签和包装: Incorrect display format with extra field container and field label

源(生成的html文件)也不同:

    Correctly displayed:

<tr><td width="190px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Profit Centre<span class="ms-formvalidation"> *</span></nobr></H3></td>
<td width="400px" valign="top" class="ms-formbody"><span dir="none">
        <input name="ctl00$m$g_193d5406_ba72_454b_b14c_87873ba714d6$ff5_1$ctl00$ctl00$TextField" type="text" value="ALL" maxlength="255" id="ctl00_m_g_193d5406_ba72_454b_b14c_87873ba714d6_ff5_1_ctl00_ctl00_TextField" title="Profit Centre" class="ms-long" /><br>
    </span></td></tr>
<tr><td width="190px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Status<span class="ms-formvalidation"> *</span></nobr></H3></td>
<td width="400px" valign="top" class="ms-formbody"><span dir="none"><select name="ctl00$m$g_193d5406_ba72_454b_b14c_87873ba714d6$ff6_1$ctl00$DropDownChoice" id="ctl00_m_g_193d5406_ba72_454b_b14c_87873ba714d6_ff6_1_ctl00_DropDownChoice" title="Status" class="ms-RadioText">
                    <option selected="selected" value="Not Yet Reconciled">Not Yet Reconciled</option>
                    <option value="Reconciled">Reconciled</option>
                    <option value="Reviewed">Reviewed</option>
                    <option value="Rejected by Reviewer">Rejected by Reviewer</option>
                    <option value="Approved">Approved</option>
                    <option value="Rejected by Approver">Rejected by Approver</option>

                </select><br></span></td></tr>


===========================================================
Annoying wrapper displayed:

<tr><td width="190px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Profit Centre<span class="ms-formvalidation"> *</span></nobr></H3></td>
<td width="400px" valign="top" class="ms-formbody">
<div align="left" class="ms-formfieldcontainer">
<div class="ms-formfieldlabelcontainer" nowrap="nowrap">
<span class="ms-formfieldlabel" nowrap="nowrap">Profit Centre</span></div>
<div class="ms-formfieldvaluecontainer">
<span dir="none">
        <input name="ctl00$m$g_7716bb24_9fc9_4e72_a2c6_bec888418014$ff6_1$ctl00$ctl00$TextField" type="text" value="ALL" maxlength="255" id="ctl00_m_g_7716bb24_9fc9_4e72_a2c6_bec888418014_ff6_1_ctl00_ctl00_TextField" title="Profit Centre" class="ms-long" /><br>
    </span></div></div></td></tr>
<tr><td width="190px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Status<span class="ms-formvalidation"> *</span></nobr></H3></td>
<td width="400px" valign="top" class="ms-formbody">
<div align="left" class="ms-formfieldcontainer">
<div class="ms-formfieldlabelcontainer" nowrap="nowrap">
<span class="ms-formfieldlabel" nowrap="nowrap">Status</span></div><div class="ms-formfieldvaluecontainer">
<span dir="none">
<select name="ctl00$m$g_7716bb24_9fc9_4e72_a2c6_bec888418014$ff7_1$ctl00$DropDownChoice" id="ctl00_m_g_7716bb24_9fc9_4e72_a2c6_bec888418014_ff7_1_ctl00_DropDownChoice" title="Status" class="ms-RadioText">
                    <option value="Not Yet Reconciled">Not Yet Reconciled</option>
                    <option selected="selected" value="Reconciled">Reconciled</option>
                    <option value="Reviewed">Reviewed</option>
                    <option value="Rejected by Reviewer">Rejected by Reviewer</option>
                    <option value="Approved">Approved</option>
                    <option value="Rejected by Approver">Rejected by Approver</option>
                </select><br></span></div></div></td></tr>

如何删除额外的字段容器和相关的字段标签?为什么在这两个SP2007环境中它的表现不同?

非常感谢您的提示和解答。提前谢谢。

1 个答案:

答案 0 :(得分:1)

事实证明这两种环境有不同的风格。 TST环境使用Microsoft.SharePoint.dll版本= 12.0.6421.1000运行SharePoint Content Management Server。虽然PRD环境是Microsoft.SharePoint.dll版本= 12.0.6565.5001的企业版。

感谢Mirjam提供的出色解决方案: http://social.msdn.microsoft.com/Forums/en-CA/sharepointcustomization/thread/f00d37d3-2254-44fa-8f4d-ae7683c645cf

解决方法是注入一段CSS样式表来覆盖这两个OOB类:

<style type="text/css">
.ms-formfieldlabelcontainer {
    display: none;
}
.ms-formfieldvaluecontainer {
    border: 0px;
    border-style:hidden;
    padding:0px;
    margin:0px;
}
</style>

现在一切看起来都很棒!