I have been trying to develop a set of pages that each has a form on the page where the user can type a response to questions on each page, and the form is saved when they submit it. If the user returns to that page, we must show the user's previous data, so they can edit and add to it.
I've been using Sharepoint designer, as I'm only new to SP and I don't know how to make a custom web part yet. I have it so it can create a record in a list, and save it. But when I return to the page, it is not selecting the correct row based on a match on the current user.
Is there a way to select the list row where the current user's ID is matched to the saved ID in the list? I have tried using Datasource Properties > "Filter..." to retrieve the correct row, but it only gets the very first row every time. This is what a screenshot of the settings look like:
I believe the following is the code that these settings create. Sorry the formatting isn't great - I'm not sure how to word wrap on here. The line in question is the longest line, which is line 3.
<WebPartPages:DataFormWebPart runat="server" SuppressWebPartChrome="False" Description="" PartImageSmall="" DataSourceID="" MissingAssembly="Cannot import this Web Part." FrameType="Default" ConnectionID="00000000-0000-0000-0000-000000000000" DetailLink="" ExportControlledProperties="True" IsVisible="True" AllowRemove="True" AllowEdit="True" ID="g_bfe9ae06_92c1_40bb_a521_eec50fa168ae" Dir="Default" FrameState="Normal" ViewContentTypeId="" AllowConnect="True" PageSize="-1" AllowMinimize="True" IsIncludedFilter="" ShowWithSampleData="True" HelpMode="Modeless" ExportMode="All" ViewFlag="0" Title="mjcooper (1)" HelpLink="" AllowHide="True" AllowZoneChange="True" PartOrder="2" UseSQLDataSourcePaging="True" PartImageLarge="" IsIncluded="True" NoDefaultStyle="TRUE" __MarkupType="vsattributemarkup" __WebPartId="{BFE9AE06-92C1-40BB-A521-EEC50FA168AE}" __AllowXSLTEditing="true" WebPart="true" Height="" Width="">
<DataSources>
<SharePointWebControls:SPDataSource runat="server" DataSourceMode="ListItem" SelectCommand="<View><Query><Where><And><Eq><FieldRef Name="ContentType"/><Value Type="Text">Item</Value></Eq><Eq><FieldRef Name="Author"/><Value Type="Integer"><UserID/></Value></Eq></And></Where></Query><ViewFields><FieldRef Name="ContentTypeId"/><FieldRef Name="Title"/><FieldRef Name="File_x0020_Type"/><FieldRef Name="comments1"/><FieldRef Name="comments2"/><FieldRef Name="ID"/><FieldRef Name="ContentType"/><FieldRef Name="Modified"/><FieldRef Name="Created"/><FieldRef Name="Author"/><FieldRef Name="Editor"/><FieldRef Name="_HasCopyDestinations"/><FieldRef Name="_CopySource"/><FieldRef Name="_UIVersion"/><FieldRef Name="_UIVersionString"/><FieldRef Name="Attachments"/><FieldRef Name="_ModerationStatus"/><FieldRef Name="FileRef"/><FieldRef Name="FileDirRef"/><FieldRef Name="Created_x0020_Date"/><FieldRef Name="FSObjType"/><FieldRef Name="FileLeafRef"/><FieldRef Name="PermMask"/></ViewFields></View>" UseInternalName="True" ID="mjcooper1">
<SelectParameters>
<WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter>
<WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{0163A995-471E-49B5-99F8-3FE73AFD52AE}" Name="ListID"></WebPartPages:DataFormParameter>
</SelectParameters>
<UpdateParameters>
<WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter>
<WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{0163A995-471E-49B5-99F8-3FE73AFD52AE}" Name="ListID"></WebPartPages:DataFormParameter>
</UpdateParameters>
<InsertParameters>
<WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter>
<WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{0163A995-471E-49B5-99F8-3FE73AFD52AE}" Name="ListID"></WebPartPages:DataFormParameter>
</InsertParameters>
<DeleteParameters>
<WebPartPages:DataFormParameter ParameterKey="ListItemId" PropertyName="ParameterValues" DefaultValue="0" Name="ListItemId"></WebPartPages:DataFormParameter>
<WebPartPages:DataFormParameter ParameterKey="ListID" PropertyName="ParameterValues" DefaultValue="{0163A995-471E-49B5-99F8-3FE73AFD52AE}" Name="ListID"></WebPartPages:DataFormParameter>
</DeleteParameters>
</SharePointWebControls:SPDataSource>
</DataSources>
Is there something I'm missing here? I would have thought that filtering on [Current User] should work?