none
Styling for new item form

    Question

  • 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 following

    1. how to hide the extra edit top in the ribbon?
    2. 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 saved

    Expected design

    Current design

    Code 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="&lt;View&gt;&lt;Query&gt;&lt;Where&gt;&lt;Eq&gt;&lt;FieldRef Name=&quot;ContentType&quot;/&gt;&lt;Value Type=&quot;Text&quot;&gt;Item&lt;/Value&gt;&lt;/Eq&gt;&lt;/Where&gt;&lt;/Query&gt;&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" 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(&quot;idAttachmentsTable&quot;);
              if (elm == null || elm.rows.length == 0)
              document.getElementById(&quot;idAttachmentsRow&quot;).style.display=&apos;none&apos;;
            </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>





    • Edited by Tweety Tan Wednesday, April 26, 2017 10:17 AM
    Wednesday, April 26, 2017 8:10 AM

All replies