Dotnetdreamer's Weblog

SharePoint, Silverlight and Azure

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

11 Responses to “Form Web Part”

  1. […] Form Web Part […]

  2. […] Form Web Part […]

  3. Jonas said

    This was exactly what I needed…except for the part that when i clear the textbox and click Go it filters everything and I can’t remove the filter from the column either. My javascript knowledge isn’t that great so if you or some1 else know how to edit the source in Source Editor to display the list unfiltered I would be greatfull 🙂

  4. venu said

    This artticle was good.
    But how we can i use the dropdown list of choices in form webpart?

    Suppose i select a item from the dropdown list, based selected item how can i get results from List view webpart?

  5. Sirisha said

    Good to see the article !!

    Thank you for posting !!

  6. Hussainmuhammad said

    good.
    this arical is very good to know how to work form web part.
    but i want to know when the text box become clear then display all record.

  7. sy said

    This is great. I looked all over for how to use the form web part, and yours was the best example. The only difference was that, when I added for the form to my page, the list was blank, and yours still had names displayed before the search.

  8. Fahad Khan said

    Can we do this by creating View in top right corner? or one question about form webpart can we add here a selection box which populated all Depts instead of text box, that would be more user friendly.

  9. nag said

    this is what i need can u plz post the source code

  10. keylogger said

    Thank you for posting !!

  11. Dan said

    The out of the box form tools leave a lot to be desired. Here is an inexpensive product that works great http://sharepointformwebpart.com/. I obtained a code for $15 off WDS15.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: