本文介绍了新项目表格的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 嗨.我已经使用SharePoint Designer在页面之一上添加了自定义列表插入表单Web部件.但是我无法弄清楚如何做如何在功能区中隐藏多余的编辑顶部? 当页面处于编辑模式时如何禁用验证?当前,如果用户要编辑页面内容,则将无法保存页面,因为将触发必填字段验证,从而导致页面无法保存 预期设计 当前设计 用于插入自定义列表新项目表单的代码< div class ="cell-margin" style ="margin:0 auto; width:60%;" < WebPartPages:DataFormWebPart runat ="服务器" ;; IsIncluded =真". FrameType =无". NoDefaultStyle =" TRUE" ViewFlag ="8".标题=反馈". PageType =" PAGE_NEWFORM" ListName ="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"默认值="FALSE" DisplayName ="Feedback" __markuptype ="vsattributemarkup"; __WebPartId ="{F30CDBD0-AD1C-4D3C-9F61-82DCD2CBFBA8}" id ="g_f30cdbd0_ad1c_4d3c_9f61_82dcd2cbfba8"< DataSources>< SharePointWebControls:SPDataSource runat ="服务器" DataSourceMode ="ListItem"; UseInternalName ="true"; UseServerDataFormat ="True" selectcommand =& lt; View& gt;< Query& gt;< Where& lt; Eq& lt; FieldRef Name =& quot; ContentType& quot; ;/& lt;值类型=& quot;文本& quot;项& lt;/值& gt;</Eq& gt;</Where& </Query>& lt;/View& gt;" id ="Feedback2">< SelectParameters>< WebPartPages:DataFormParameter Name =" ListItemId" ParameterKey ="ListItemId". PropertyName ="ParameterValues" DefaultValue ="0"/< WebPartPages:DataFormParameter Name ="ListID"; ParameterKey ="ListID". PropertyName ="ParameterValues" DefaultValue ="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"/< WebPartPages:DataFormParameter Name ="MaximumRows"; ParameterKey ="MaximumRows". PropertyName ="ParameterValues" DefaultValue ="10"/</SelectParameters>< DeleteParameters>< WebPartPages:DataFormParameter Name ="ListItemId"; ParameterKey ="ListItemId". PropertyName ="ParameterValues" DefaultValue ="0"/< WebPartPages:DataFormParameter Name ="ListID"; ParameterKey ="ListID". PropertyName ="ParameterValues" DefaultValue ="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"//</DeleteParameters>< InsertParameters>< WebPartPages:DataFormParameter Name ="ListItemId" ParameterKey ="ListItemId". PropertyName ="ParameterValues" DefaultValue ="0"/< WebPartPages:DataFormParameter Name ="ListID"; ParameterKey ="ListID". PropertyName ="ParameterValues" DefaultValue ="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"//</InsertParameters>< UpdateParameters>< WebPartPages:DataFormParameter Name ="ListItemId" ParameterKey ="ListItemId". PropertyName ="ParameterValues" DefaultValue ="0"/< WebPartPages:DataFormParameter Name ="ListID"; ParameterKey ="ListID". PropertyName ="ParameterValues" DefaultValue ="{{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}}"//</UpdateParameters></SharePointWebControls:SPDataSource></DataSources>< ParameterBindings>< ParameterBinding Name =" ListItemId"位置="QueryString(ID)"; DefaultValue ="0"/>< ParameterBinding Name ="ListID";位置=无" DefaultValue ="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"< ParameterBinding Name ="MaximumRows";位置=无" DefaultValue ="10"/>< ParameterBinding Name ="dvt_’";位置=回发;连接"/>< ParameterBinding Name ="ManualRefresh";位置="WPProperty [ManualRefresh]"/>< ParameterBinding Name ="UserID";位置=可压缩". DefaultValue ="CurrentUserName"/>< ParameterBinding Name =今天"位置=可压缩". DefaultValue ="CurrentDate"/></ParameterBindings>< datafields> @ Title,Title; @ Email,Email; @ Subject,Subject; @ Description,Description; @ ID,ID; @ ContentType,Content Type; @ Modified,Modified; @ Created,Created; @ Author,Created by ; @ Editor,Modified By; @_ UIVersionString,Version; @ Attachments,Attachments; @ File_x0020_Type,File Type; @ FileLeafRef,Name(供表格使用); @ FileDirRef,Path; @ FSObjType,Item Type; @_ HasCopyDestinations,已复制目的地; @_ CopySource,Copy Source; @ContentTypeId,内容类型ID; @_ ModerationStatus,批准状态; @_ UIVersion,UI版本; @ Created_x0020_Date,Created; @ FileRef,URL路径; @ ItemChildCount,Item Child Count; @ FolderChildCount,Folder Child Count; @AppAuthor,创建的应用; @AppEditor,修改的应用;</datafields>< XSL>< xsl:stylesheet xmlns:x ="http://www.w3.org/2001/XMLSchema" xmlns:dsp ="http://schemas.microsoft.com/sharepoint/dsp"版本="1.0" exclude-result-prefixes ="xsl msxsl ddwrt"; xmlns:ddwrt ="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp ="http://schemas.microsoft.com/ASPNET/20"; xmlns:__ designer =" http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl ="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl ="urn:schemas-microsoft-com:xslt" xmlns:SharePoint =" Microsoft.SharePoint.WebControls" xmlns:ddwrt2 ="urn:frontpage:internal">< xsl:output method ="html" indent =否"/>< xsl:十进制格式NaN ="/>< xsl:param name ="dvt _’"</xsl:param>< xsl:param name ="ManualRefresh">//xsl:param>< xsl:variable name ="dvt_1_automode"> 0lt;/xsl:variable>< xsl:template match ="//xmlns:x ="http://www.w3.org/2001/XMLSchema" xmlns:dsp ="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp ="http://schemas.microsoft.com/ASPNET/20"; xmlns:__ designer =" http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint ="Microsoft.SharePoint.WebControls"< xsl:choose>< xsl:when test =($ ManualRefresh ='True')'><表的宽度="100%". border ="0" cellpadding ="0" cellspacing ="0"< tr>< td valign =顶部">< xsl:call-template name ="dvt_1"/></td></tr></table></xsl:when>< xsl:otherwise>< xsl:call-template name ="dvt_1"/></xsl:otherwise></xsl:choose></xsl:template>< xsl:template name =" dvt_1">< xsl:variable name =" dvt_StyleName"" ListForm</xsl:variable>< xsl:variable name =行"选择="/dsQueryResponse/行/行"/>< div>< span id ="part1">< table border ="0"宽度="100%".< xsl:call-template name ="dvt_1.body">< xsl:with-param name =行" select ="$ Rows"/></xsl:call-template></table></span>< SharePoint:AttachmentUpload runat ="服务器" ControlMode ="New"/>.< SharePoint:ItemHiddenVersion runat ="服务器" ControlMode ="New"/>.</div></xsl:template>< xsl:template name ="dvt_1.body">< xsl:param name =行"/>< tr>< td class ="ms-toolbar" nowrap ="nowrap"< SharePoint:FormToolBar runat ="服务器" ControlMode ="New"/>.< SharePoint:ItemValidationFailedMessage runat ="服务器" ControlMode ="New"/>.</td></tr>< xsl:call-template name =" dvt_1.rowedit">< xsl:with-param name ="Pos" select ="concat('_',position())'"; /></xsl:call-template>< tr>< td class ="ms-toolbar" nowrap ="nowrap" style ="text-align:center"< table>< tr>< td class ="ms-toolbar" nowrap ="nowrap" style ="padding-left:2em;"< SharePoint:SaveButton runat ="服务器" ControlMode =新". id ="savebutton2"></SharePoint:SaveButton></td>< td class ="ms-separator"</td>< td class ="ms-toolbar" nowrap ="nowrap" align ="right"< SharePoint:GoBackButton runat ="服务器" ControlMode =新". id ="gobackbutton2"/></td></tr></table></td></tr></xsl:template>< xsl:template name =" dvt_1.rowedit">< xsl:param name ='Pos' select ="position()"/< tr>< td>< table border ="0" cellspacing ="0"宽度="100%".< tr>< td width ="100px" valign ="top" class ="ms-formlabel">< H3 class ="ms-standardheader">< nobr>名称< span class ="ms-formvalidation"> *</span></nobr></H3></td>< td width ="400px" valign ="top" class ="ms-formbody"< SharePoint:FormField runat ="服务器" id ="ff1 {$ Pos}" ControlMode =新". FieldName =标题"; __designer:bind =" {ddwrt:DataBind('i',concat('ff1',$ Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@标题')}''//;< SharePoint:FieldDescription runat ="服务器" id ="ff1description {$ Pos}" FieldName =标题"; ControlMode ="New"/>.</td></tr>< tr>< td width ="100px" valign ="top" class ="ms-formlabel">< H3 class ="ms-standardheader">< nobr>电子邮件</nobr></H3></td>< td width ="400px" valign ="top" class ="ms-formbody"< SharePoint:FormField runat ="服务器" id ="ff2 {$ Pos}" ControlMode =新". FieldName =电子邮件"; __designer:bind =" {ddwrt:DataBind('i',concat('ff2',$ Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@电子邮件')}"< SharePoint:FieldDescription runat ="服务器" id ="ff2description {$ Pos}" FieldName =电子邮件" ControlMode ="New"/>.</td></tr>< tr>< td width ="100px" valign ="top" class ="ms-formlabel">< H3 class ="ms-standardheader">< nobr>主题</nobr></H3></td>< td width ="400px" valign ="top" class ="ms-formbody"< SharePoint:FormField runat ="服务器" id ="ff3 {$ Pos}" ControlMode =新". FieldName =主题"; __designer:bind =" {ddwrt:DataBind('i',concat('ff3',$ Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@主题')}''//;< SharePoint:FieldDescription runat ="服务器" id ="ff3description {$ Pos}" FieldName =主题"; ControlMode ="New"/>.</td></tr>< tr>< td width ="100px" valign ="top" class ="ms-formlabel">< H3 class ="ms-standardheader">< nobr>说明</nobr></H3></td>< td width ="400px" valign ="top" class ="ms-formbody"< SharePoint:FormField runat ="服务器" id ="ff4 {$ Pos}" ControlMode =新". FieldName =描述"; __designer:bind =" {ddwrt:DataBind('i',concat('ff4',$ Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@说明')}"< SharePoint:FieldDescription runat ="服务器" id ="ff4description {$ Pos}" FieldName =描述"; ControlMode ="New"/>.</td></tr>< tr id ="idAttachmentsRow">< td nowrap ="true"; valign ="top" class ="ms-formlabel"宽度="20%".< SharePoint:FieldLabel ControlMode ="New"; FieldName =附件"; runat =服务器"/></td>< td valign ="top" class ="ms-formbody"宽度="80%".< SharePoint:FormField runat ="服务器" id ="AttachmentsField"; ControlMode =新". FieldName =附件"; __designer:bind =" {ddwrt:DataBind('i','AttachmentsField','Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@ Attachments')}'' />< script> var elm = document.getElementById(&"idAttachmentsTable&"); if(elm == null || elm.rows.length == 0) document.getElementById(& id" idAttachmentsRow& quot;).style.display =&'none&'; </script></td></tr>< xsl:if test ="$ dvt_1_automode ='1'" ddwrt:cf_ignore ="1">< tr>< td colspan ="99"; class ="ms-vb">< span ddwrt:amkeyfield =" ID" ddwrt:amkeyvalue =" ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode ="view"</span></td></tr></xsl:if></table></td></tr></xsl:template></xsl:stylesheet> </XSL></WebPartPages:DataFormWebPart></div> 解决方案 Hi.i have added the custom list insert form web part on one of my page using SharePoint Designer.However i am not able to figure out how to do the followinghow to hide the extra edit top in the ribbon?how do i disable validation when the page is in edit mode? currently, if the user were to edit the page content they will not be able to save the page as the required field validation will be fired preventing the page from being savedExpected designCurrent designCode for inserting the custom list new item form<div class="cell-margin" style="margin:0 auto;width:60%;"> <WebPartPages:DataFormWebPart runat="server" IsIncluded="True" FrameType="None" NoDefaultStyle="TRUE" ViewFlag="8" Title="Feedback" PageType="PAGE_NEWFORM" ListName="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}" Default="FALSE" DisplayName="Feedback" __markuptype="vsattributemarkup" __WebPartId="{F30CDBD0-AD1C-4D3C-9F61-82DCD2CBFBA8}" id="g_f30cdbd0_ad1c_4d3c_9f61_82dcd2cbfba8"><DataSources><SharePointWebControls:SPDataSource runat="server" DataSourceMode="ListItem" UseInternalName="true" UseServerDataFormat="True" selectcommand="<View><Query><Where><Eq><FieldRef Name="ContentType"/><Value Type="Text">Item</Value></Eq></Where></Query></View>" id="Feedback2"><SelectParameters><WebPartPages:DataFormParameter Name="ListItemId" ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0"/><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"/><WebPartPages:DataFormParameter Name="MaximumRows" ParameterKey="MaximumRows" PropertyName="ParameterValues" DefaultValue="10"/></SelectParameters><DeleteParameters><WebPartPages:DataFormParameter Name="ListItemId" ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0"/><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"/></DeleteParameters><InsertParameters><WebPartPages:DataFormParameter Name="ListItemId" ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0"/><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"/></InsertParameters><UpdateParameters><WebPartPages:DataFormParameter Name="ListItemId" ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0"/><WebPartPages:DataFormParameter Name="ListID" ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"/></UpdateParameters></SharePointWebControls:SPDataSource></DataSources><ParameterBindings><ParameterBinding Name="ListItemId" Location="QueryString(ID)" DefaultValue="0"/><ParameterBinding Name="ListID" Location="None" DefaultValue="{C4AA2F52-5D73-4E72-8A83-1E647DA5B4B5}"/><ParameterBinding Name="MaximumRows" Location="None" DefaultValue="10"/><ParameterBinding Name="dvt_apos" Location="Postback;Connection"/><ParameterBinding Name="ManualRefresh" Location="WPProperty[ManualRefresh]"/><ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/><ParameterBinding Name="Today" Location="CAMLVariable" DefaultValue="CurrentDate"/></ParameterBindings><datafields>@Title,Title;@Email,Email;@Subject,Subject;@Description,Description;@ID,ID;@ContentType,Content Type;@Modified,Modified;@Created,Created;@Author,Created By;@Editor,Modified By;@_UIVersionString,Version;@Attachments,Attachments;@File_x0020_Type,File Type;@FileLeafRef,Name (for use in forms);@FileDirRef,Path;@FSObjType,Item Type;@_HasCopyDestinations,Has Copy Destinations;@_CopySource,Copy Source;@ContentTypeId,Content Type ID;@_ModerationStatus,Approval Status;@_UIVersion,UI Version;@Created_x0020_Date,Created;@FileRef,URL Path;@ItemChildCount,Item Child Count;@FolderChildCount,Folder Child Count;@AppAuthor,App Created By;@AppEditor,App Modified By;</datafields><XSL><xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" version="1.0" exclude-result-prefixes="xsl msxsl ddwrt" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:SharePoint="Microsoft.SharePoint.WebControls" xmlns:ddwrt2="urn:frontpage:internal"><xsl:output method="html" indent="no"/><xsl:decimal-format NaN=""/><xsl:param name="dvt_apos">'</xsl:param><xsl:param name="ManualRefresh"></xsl:param><xsl:variable name="dvt_1_automode">0</xsl:variable><xsl:template match="/" xmlns:x="http://www.w3.org/2001/XMLSchema" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:asp="http://schemas.microsoft.com/ASPNET/20" xmlns:__designer="http://schemas.microsoft.com/WebParts/v2/DataView/designer" xmlns:SharePoint="Microsoft.SharePoint.WebControls"><xsl:choose><xsl:when test="($ManualRefresh = 'True')"><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><xsl:call-template name="dvt_1"/></td></tr></table></xsl:when><xsl:otherwise><xsl:call-template name="dvt_1"/></xsl:otherwise></xsl:choose></xsl:template><xsl:template name="dvt_1"><xsl:variable name="dvt_StyleName">ListForm</xsl:variable><xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/><div><span id="part1"><table border="0" width="100%"><xsl:call-template name="dvt_1.body"><xsl:with-param name="Rows" select="$Rows"/></xsl:call-template></table></span><SharePoint:AttachmentUpload runat="server" ControlMode="New"/><SharePoint:ItemHiddenVersion runat="server" ControlMode="New"/></div></xsl:template><xsl:template name="dvt_1.body"><xsl:param name="Rows"/><tr><td class="ms-toolbar" nowrap="nowrap"><SharePoint:FormToolBar runat="server" ControlMode="New"/><SharePoint:ItemValidationFailedMessage runat="server" ControlMode="New"/></td></tr><xsl:call-template name="dvt_1.rowedit"><xsl:with-param name="Pos" select="concat('_', position())" /></xsl:call-template><tr><td class="ms-toolbar" nowrap="nowrap" style="text-align:center"><table><tr><td class="ms-toolbar" nowrap="nowrap" style="padding-left:2em;"><SharePoint:SaveButton runat="server" ControlMode="New" id="savebutton2"></SharePoint:SaveButton></td><td class="ms-separator"> </td><td class="ms-toolbar" nowrap="nowrap" align="right"><SharePoint:GoBackButton runat="server" ControlMode="New" id="gobackbutton2"/></td></tr></table></td></tr></xsl:template><xsl:template name="dvt_1.rowedit"><xsl:param name="Pos" select="position()"/><tr><td><table border="0" cellspacing="0" width="100%"><tr><td width="100px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Name<span class="ms-formvalidation"> *</span></nobr></H3></td><td width="400px" valign="top" class="ms-formbody"><SharePoint:FormField runat="server" id="ff1{$Pos}" ControlMode="New" FieldName="Title" __designer:bind="{ddwrt:DataBind('i',concat('ff1',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Title')}"/><SharePoint:FieldDescription runat="server" id="ff1description{$Pos}" FieldName="Title" ControlMode="New"/></td></tr><tr><td width="100px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Email</nobr></H3></td><td width="400px" valign="top" class="ms-formbody"><SharePoint:FormField runat="server" id="ff2{$Pos}" ControlMode="New" FieldName="Email" __designer:bind="{ddwrt:DataBind('i',concat('ff2',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Email')}"/><SharePoint:FieldDescription runat="server" id="ff2description{$Pos}" FieldName="Email" ControlMode="New"/></td></tr><tr><td width="100px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Subject</nobr></H3></td><td width="400px" valign="top" class="ms-formbody"><SharePoint:FormField runat="server" id="ff3{$Pos}" ControlMode="New" FieldName="Subject" __designer:bind="{ddwrt:DataBind('i',concat('ff3',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Subject')}"/><SharePoint:FieldDescription runat="server" id="ff3description{$Pos}" FieldName="Subject" ControlMode="New"/></td></tr><tr><td width="100px" valign="top" class="ms-formlabel"><H3 class="ms-standardheader"><nobr>Description</nobr></H3></td><td width="400px" valign="top" class="ms-formbody"><SharePoint:FormField runat="server" id="ff4{$Pos}" ControlMode="New" FieldName="Description" __designer:bind="{ddwrt:DataBind('i',concat('ff4',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Description')}"/><SharePoint:FieldDescription runat="server" id="ff4description{$Pos}" FieldName="Description" ControlMode="New"/></td></tr><tr id="idAttachmentsRow"><td nowrap="true" valign="top" class="ms-formlabel" width="20%"><SharePoint:FieldLabel ControlMode="New" FieldName="Attachments" runat="server"/></td><td valign="top" class="ms-formbody" width="80%"><SharePoint:FormField runat="server" id="AttachmentsField" ControlMode="New" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('i','AttachmentsField','Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Attachments')}"/><script> var elm = document.getElementById("idAttachmentsTable"); if (elm == null || elm.rows.length == 0) document.getElementById("idAttachmentsRow").style.display='none'; </script></td></tr><xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1"><tr><td colspan="99" class="ms-vb"><span ddwrt:amkeyfield="ID" ddwrt:amkeyvalue="ddwrt:EscapeDelims(string(@ID))" ddwrt:ammode="view"></span></td></tr></xsl:if></table></td></tr></xsl:template></xsl:stylesheet></XSL></WebPartPages:DataFormWebPart></div> 解决方案 这篇关于新项目表格的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-29 17:38