Dotnetdreamer's Weblog

SharePoint, Silverlight and Azure

Posts Tagged ‘Form Web Parts’

Form Web Part

Posted by Ramprasad Navaneethakrishnan on May 9, 2009

This post discusses about Form Web Part which is an out-of-the-box web part available with MOSS 2007.  Other out-of-the-box MOSS 2007 webparts are discussed here.

Form Web Part unlike other web parts does not operate alone. Usually this web part is used to provide input to other web parts / lists to act accordingly. For example,

  • Form web part can pass the url / path of an image that is to be displayed in the Picture web part.
  • Form web part can pass the value of the filter to be applied to a column in the sharepoint list.

Let us take one of the examples and discuss in detail.

There is a sharepoint list with the name ‘EmployeeDetails’ with the following columns. Name, Title, Email and Department.  The lists looks something like this

formwebpart-employeedetails

The requirement is, we want to dynamically apply the filter on the Department column. ie, we might want to see employees belonging to department ‘HR’ at one time and employees beloging to department ‘Sales’ another time.

For this, lets Add a Form Web Part to the page.

  1. Go to Site Actions –> Edit Page
  2. Click Add a Web Part
  3. Select Form Web Part from the list of web parts displayed
  4. By default, Form web part contains a  textbox and a ‘Go’ button.
  5. Variety of controls like Labels, check boxes etc can be added to the Form Web Part using the Source Editor present in the tool pane.( A web part’s tool pane can be accessed byclicking Modify Shared Web Part option present in the Edit menu of that web part). For simplicity, lets make use of the default controls available with the Form web part. Now the page looks something like this
  6. formwebpart
  7. Now in the Form Web Part, go to Edit –> Connections –> Provide values to –> Select ‘EmployeeDetails’.  This will open ‘Configure Connection’ dialog box.
  8. formwebpart-configureconnection
  9. Select Column T1 and click next (Note T1 is the name of the textbox in the form web part which you can see from the Source Editor of Form Web Part)
  10. Now a second dialog box appears that lists the columns present in the ‘EmployeeDetails’ list. Select the column for which we need to apply the filter. In our case it is ‘Deparment’ column
  11. formwebpart-configureconnection3
  12. Click Next or Finish to complete the configuration
  13. Now to list employee belonging to the department ‘HR’, enter ‘HR’ in the textbox of form web part and click Go. You can see the filtered EmployeeDetailas as below
  14. formwebpart-result1
  15. To get employees belong to Sales department, enter ‘Salee’ in the Form Web Part to get the needed list like below.
  16. formwebpart-result2

 

Hope this is useful..

Please leave your comments.

Thanks.

Advertisements

Posted in MOSS 2007 | Tagged: , , , , , | 11 Comments »