Helio Gomes

Hi there,

I'm currently working on a project with Sharepoint 2007 and I need some help to deal with two issues.

1) I have a list that has dependent columns. I have a column "Department" (dropdown list) and a column "Section" (dropdown list). The requirement is that the set of values available in dropdown "Section" depends on the selected value of "Department". For example, if I select Department="DepA", the values available to Section should be A1, A2, A3. If I select Department="DepB", the values available to Section should be B1, B2. I would like to put this dependencies configured in another list (with columns Department and Section), somehow hidden. But I'm not figuring how can I implement this type of dependency in the editing form. Is there any out-of-the-box possibility

Currently, I'm thinking in creating a custom field type, where I select a dependencies list and the column in that list to filter the field. For the previous example, I would set the column "Section" to this new type. Then I would select the configuration list and the column "Department" to filter in that list.

2) The second requirement deals with a dependency between fiels too. But it's about required fields if another one has a determined value. For example, I want field "Licence number" to be required only if the field "Has licence"=Yes. How can I force this validation

By the way, I'm having some problems with the validation of Required fields in tasks generated by SP Designer workflow actions "Collect data from user". I define the fields as to not allow empty values but some types of fields aren't being validated - Choices and some Dates. I checked the content types created by the action and the columns are marked as Required. I don't understand why this is happenning.

Thanks in advance for your attention.



Re: SharePoint - Development and Programming Dependent columns in Sharepoint lists

Mart Muller

Hi,

There is no out of the box feature for that. As you said, this can be resolved by creating a custom field type. This is also the case for your second question, although you might be able to do something with javascript as well.

- Mart






Re: SharePoint - Development and Programming Dependent columns in Sharepoint lists

Aaron Robertson-Hodder

I have to say I was hoping this might be a feature in V3, but the argument I heard for it not being was around dependency issues across lists/fields.

Although you might also be able to do something with JavaScript around grabbing the list item details from a web service call, ie. to the GetListItems method and setting the child field when the parent is changed, custom field types is probably the best option.

Just be sure that you really need to create a custom field, because they are not supported from client apps such as Office and this makes it hard to enforce data integrity if the user has to save the document, then go to the Web UI to update the custom field(s), ie. they wont! ;-)

Of course you can use a custom InfoPath form for the Document Information Panel, if your deployment if Office 2007 and meets the requirements for custom DIP...






Re: SharePoint - Development and Programming Dependent columns in Sharepoint lists

Helio Gomes

Thanks for your answers Mart and Aaron.

I have developed a custom field for the first issue, and used javascript for the second.

The custom field needs (data requested on the creation of new columns) the name of a dependency configuration list, and the columns in that list that will be displayed as dropdown lists in edit forms. For example, we may have a list "Organization Structure" with columns Department and Section with the dependencies between them. Creating a column in a list of this new type, we configure:

- Name of the dependencies list = "Organization Structure"

- Column 1 = "Department"

- Column 2 = "Section"

This column will appear in edit forms as a group of two dropdown lists, Column 1 and Column 2. By selecting a value in the first one, a postback is made to the server, which populates the second one with the appropriate values. I'm still developing the custom field but this is the main idea.





Re: SharePoint - Development and Programming Dependent columns in Sharepoint lists

SharePointing

I think the theory is that if you are going to do things that complex in your forms, you should use InfoPath/Forms Server... Simple stuff is possible through the IDE OOB, go beyond that and the coding is not trivial ;-)




Re: SharePoint - Development and Programming Dependent columns in Sharepoint lists

Sergio Calleja

Hi,
i'm trying to do somethig like you want to do. Can you explain me how you have take the values with the javascript





Re: SharePoint - Development and Programming Dependent columns in Sharepoint lists

Helio Gomes

I only used Javascript for the second issue.

To get the html IDs, I opened the form in browser and search in its source for the IDs of the controls that I wanted to validate. Then, I used them in the Javascript of the form. I used this trick because I don't know any other way to automatically obtain the client IDs of the controls (if there is a better option, please tell us anyone).