Create a Form to Add New Items to a SharePoint List
- Open SharePoint Designer
- Open Your Site
- Browse to test.aspx
- Right-click on you page and choose "Check-out"
- Right-click again and choose "Detach from Page Layout" and click yes when the dialog box opens up.
- Another dialog box opens up which says we're good to go.
- Now double-click your ASPX page to view the page.
- Select the web part zone you wish to work in (I chose the header zone).
- Go to the Data View menu and choose "Insert Data View". This will automatically display the Data Source Library pane on the top right with all of the SharePoint lists available on the site.
- Click on the Task List drop down menu and select the Show Data option
- For our new form items we’re going to select Title, Assigned to, and Due date.
- Note: the order you select your data field matters because this is the default order that the elements get placed in your form.
- Scroll back up to the top of the Data Source Details panel and click Insert Selected Fields As option and select “New Item Form”
- Notice how “Title” is automatically shown as being required.
- “Assigned To” is automatically shown as a user selection.
- Due Date is a date/time field automatically set by SharePoint, but this can be overridden.
- This is because your fields will respect their preconfigured settings.
- Select your element.
- Click on the arrow in the top-right corner or your DataView web part to open the “Common Data View Tasks” menu and select “Edit Columns”
- Highlight Due Date
- Click on the “Move Up” button to change position and click OK.
- Select the “Due Date” field
- Open up the “Common FormField Tasks” menu
- Select the “Format As” and change it to Date Picker.
Create a Form to Edit SharePoint List Items
Now we can use SharePoint Designer to create a form which edits existing items in a SharePoint List. Here are the steps.- Add data view web part to a zone
- Select a web part zone you wish your form to live
- Select the Data View menu > Insert Data View
- This will automatically display the Data Source Library pane on the top-right with all of the SharePoint lists available on the site.
- Click on the Task List drop down menu and select the Show Data option.
- Now select only the Title and Due Date fields.
- Scroll back up to the top of the Data Source Details panel and click Insert Selected Fields As option and select “Multiple Item Form”
Changing the View
What if we need to alter the default view to sort on due date, or group items based on who they are assigned to? Simple.- Click on the arrow in the top-right corner or your DataView web part to open the Common DataView Tasks menu and select the Sort and Group link. The Sort and Group dialog box pops up.
- Now select Assigned To and Due Date and click on the Add button to move them from the left column to the right.
- In the right, Highlight the Assigned To field and click on the Show Group Header, leave the Expand group by default option selected, and click OK to apply the changes.
- Click on the arrow in the top-right corner of the Common DataView Tasks menu to collapse it and view your new modified view.
- Save your changes by either clicking on the save icon or go to File > Save.
Time to Unit Test
As with anything we develop, we’ve reach the point where we will want to test our work.- So let’s view our page in the browser by right-clicking on your new page in SPD and select View in Internet Explorer.
- In the title field add a title, pick a due date and time, choose a person to assign your task to, and click Save.
- Click refresh in the browser and we can now see the multiple item form data view updates in the bottom.
http://www.youtube.com/watch?v=yHtzKsOwqqQ
No comments:
Post a Comment