how to pass embedded schemas as drop down for the content schema in SDL Tridion 2011 SP1

大憨熊 提交于 2019-12-10 09:22:22

问题


I am trying to create a schema in SDL Tridion to satisfy these requirements.

I have two main fields:

  1. ABCD, which has one sub field as "XYZ"
  2. AAAA, which has two sub fields namely "Name" and "Value"

Both main fields are repeatable and and should be movable.

Example patterns may look as per requirement:

ABCD----AAAA----ABCD---AAAA
AAAA----ABCD----ABCD----AAAA

The main fields AAAA and ABCD should be moved from one to another.

Say if I create a component with the created schema and the first main fields as "AAAA" and second field as "ABCD", then I should be able to move ABCD above the AAAA.

I have tried creating an embedded schema with two fields:

  1. select Main field: As a list, where I select either ABCD and AAAA as a TEXT type.

  2. Text: enter the text.

Added this schema as part of content schema as multivalued which allows "reposting and repeating".

Problems facing:

  • As the fields are not common to both main fields, I am unable to enter the data for it and the common subfield for both main fields doesn't satisfy the need..

Solution Needed:

  • If I create two embedded schemas with the names "ABCD" and "AAAA" with the required fields, can I add these schemas as part of drop down in the main content schema?

  • If user selects embedded schema "ABCD", it should display only "XYZ" field. If user selects "AAAA", i should display its subfields as "Name" and "Value".

If this is not feasible can you please suggest the best possible to solution to meet the requirement?

I am using DWT TBB and XSLT TBB for rendition part.

Thank you.


回答1:


I don't believe this is supported using the out of the box SDL Tridion Web Schemas (Although a number of great undocumented schema changes have crept into the product lately) . Tridion Web Schemas use a sequence in the XSD to control the order (and numbers) of the fields which prevents you from having a multi-value field with two types of Embedded Schema. You could however use a complex schema (i.e. model your data yourself by designing your own schema or modifying one you built using the GUI using the source tab), but would likely longer be able to use the GUI to edit your content.

Is there anyway you could use a multi-value Component Link field rather than an Embedded Schema? That way you can link the field to items of type AAAA or ABCD and put them in any order you want.




回答2:


If you want to stay within the realm of Tridion Web Schemas this is indeed not possible. As Chris explained, if you start using a Complex Schema for this, you loose the form based UI for editing a Component.

Only solution I can think of is to add all fields of ABCD and AAAA to an embeddable Schema and make everything non mandatory. If content validation is important, then you can implement an event system which does the check on save of the Component. In here you could do conditional checks, if the fields form the ABCD part of your embeddable schema are filled it will ignore or can even clear the AAAA fields and vice versa.

Your template code will now need to make the decision on what content to show. If all of the fields on the embeddable schema are filled, it needs to make a choice on what to show, otherwise it can show just the content which is entered. You should make the logic of the template clear in the field description of the embeddable Schema, so you can guide the Content Editor into what content is required in which scenario (supported by an event system on save to validate the correctness).



来源:https://stackoverflow.com/questions/10281646/how-to-pass-embedded-schemas-as-drop-down-for-the-content-schema-in-sdl-tridion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!