0
votes

So I'm new in Sharepoint using sharepoint 2010 and I need to create an advanced form like cascading dropdownlist with two or more dropdownlist kind of thing or with javascript.

I read that there are 3 ways to do it: sharepoint designer, infopath and visual studio.

I see how to doing it in visual studio could be a litle complicated.

So I want to know which one is the best way to this form and if you have some book or that kind of thing to learn how to this.

2
Both answers give you some good starting places. I would focus on InfoPath, but it will require a SharePoint 2010 Enterprise license to present your custom forms to the user.EtherDragon

2 Answers

1
votes

Like most complex frameworks, SharePoint development is something you will want to do some research on before you just start attempting to sling code.

Getting started video: http://msdn.microsoft.com/en-us/sharepoint/ee513147.aspx

MSDN Mag getting started article: http://msdn.microsoft.com/en-us/magazine/ee309510.aspx

Book to get you started: http://www.amazon.com/Professional-SharePoint-2010-Development-Programmer/dp/0470529423

1
votes

You're in luck, because InfoPath 2010 can handle cascading lookups. I've done it myself before. I'm going to assume that you have a hierarchical relationship of data, where A is parent of B is parent of C e.g. State -> County -> City. We'll use the State -> County -> City example. This information will be stored in an Office list, as we need to know each of these things for our offices (yeah, it's a stretch, work with me here).

So first off, because this is also tagged SharePoint, I'm assuming you have a State, County, and City list. County has a lookup field into the State list and City looks up into County. Each of these lists has a Name field. Without any logic, I could choose Los Angeles but I would still be able to choose Alabama as the state and Orange as the county.

So, to making it all work. First off, choose "Customize form in InfoPath" in SharePoint on the Office list, which will fire up InfoPath Designer and have a default layout created. Customize the layout of this form to your heart's desire.

Now, to get the cascading dropdowns to work, you will need to make note of a few things. The value that is stored in each dropdown is the ID of the item. The value that is displayed is whatever you chose to display when you created the lookups on the Office list.

You will need to set a rule on the top level (State) to set the lower levels (County and City) to blank values when the field is changed. Repeat for County; it has to set City to be blank. This ensures that if you choose a new State (or county) the lower levels will be refreshed.

The next step is to filter the data. Filter the county dropdown so that the State column on County is equal to the State field in the form. Repeat for the City so that the County column is equal to the value of the County dropdown in the form.

You may need to create another Web service for the County and City as the default Web service may not have the State or County columns. If you need to, only choose the fields that you need to in order to cut down on the data transferred. For saving more data, you might also want to set it so data is queried at the lower levels when the top level changes; this would be the first step in the on change rule. The top level (State) would still need to load on form load, but the others wouldn't need to load automatically. That way you don't load all data at once. If you have many items, this may be required as InfoPath by default has a 1.5MB data load limit.

If you need more clarification, let me know.