2

I have two content types:

1) Fruits 2) vegetables

I want a choice value (let's say Plants) to have items based on the selected content type while creating the list item.

for example; if Fruits is selected the plants field should show (apple,orange,banana etc) and if vegetables is selected on creation then the field should have (broccoli,spinach, cauliflower etc)

2
  • Why not create two choice columns and associate them in respective content types ? It would be easier, the above would require some programming effort Jan 4, 2017 at 11:02
  • If I am not wrong they will have to be named different - like Fruit Plants or Vegetable Plants (so that they are unique). The end user does not want to see two different names for same thing.
    – digi
    Jan 4, 2017 at 11:05

1 Answer 1

1

You need to add the cascaded dropdown list as per the input it will be either the Fruits or Vegetables.

If you have clicked on the Fruits then all the items from the frouit Content Type should appear to the dropdown list and if you clicked on the Vegetables then all the items from the Vegetable Content Type Should be appear to dropdown list. For assigning the all the items to the dropdownlist you need to add that with the help of Content Type, with programmatically or with JS.

Click here, here1, here3

Hope this will help you!

4
  • I considered this approach first but the problem that I see here is that these customizations need will have to be done on List level and if I have to do the same thing in multiple sites I will have to repeat this step for every site. If it were possible to do it on "content type" level I could easily inherit it and use it in all sites.
    – digi
    Jan 4, 2017 at 11:33
  • You can have another option as an InfoPath Form. There also you can do the same things, but I have not tested yet with the help of Content Type.
    – Ram
    Jan 4, 2017 at 11:46
  • Leave the Plants column empty, use one ClientSideRendering template to add items based on contenttype, If you load the CSR template with a UserCustomAction you do not have to apply JSLinks all over the place Jan 4, 2017 at 11:49
  • thanks, but does this mean that I have no other option to make it re-usable in a better way?
    – digi
    Jan 5, 2017 at 3:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.