5

We have a schema that includes an optional multivalue embedded field. The schema for this embedded field has 3 optional single text fields, 2 mandatory single text fields and 1 mandatory dropdown select field.

The problem we encounter is that whenever you create a new component based on this schema, you HAVE to fill in all the mandatory fields in the embedded fields in this component, even though the embedded field itself is optional. The cause of this seems to be the mandatory dropdown field that is prefilled by Tridion.

It seems the only workaround is to make the embedded dropdown select field optional.

Is there any other way to solve this?

2
  • Without the drop-down, an optional embedded Schema would let you save even with mandatory fields from the embedded Schema, right? Commented Jul 17, 2015 at 16:52
  • Yes that's correct. So the problem is purely about the dropdown field blocking the optional embedded schema.
    – Kah Tang
    Commented Jul 21, 2015 at 8:22

3 Answers 3

5

If you have flexibility to switch the field types, you might consider changing the dropdown to a radio button since it also only allows one value to be selected, as in a dropdown, but isn't prepopulated by Tridion when you create a new component.

3
  • Thanks. This seems to be a good solution. Although the only issue I see with this solution is that you can't deselect the radio button.
    – Kah Tang
    Commented Jul 14, 2015 at 14:14
  • You can deselect a radio button by switching to the "Source" tab and deleting the XML node corresponding to your field. Commented Jul 14, 2015 at 14:21
  • I'd rather not let the content editor edit the source tab. You never know what they do with that kind of power. We have created a ticket for SDL to look at it. It seems like something they could solve.
    – Kah Tang
    Commented Jul 15, 2015 at 7:52
2

There is one other solution proposed by a colleague. And that is to change the field to a keyword selection field (type Tree in schema field specification). This will allow you to select a keyword and empty the field when you need to. When left empty it will not add the optional embedded field element to your component XML

1
  • This solution works for me! :)
    – Andy Ross
    Commented Oct 29, 2015 at 20:21
1

I think if the embedded field is optional, you shouldn't be required to fill in the dropdown within it, but the way embedded fields are pre-loaded does not allow for that. The problem is that the mandatory fields within the embeddable field have some default values assigned to them, which make the embedded field having a value in one of its embedded fields, forcing Tridion to validate the rest of the embedded fields.

Embedded mandatory field prepopulated from list

You can remove the embedded field from the "Source" tab as somebody suggests in another answer:

enter image description here

but I guess that's not optimal for Content Managers.

So I would recommend making the dropdown field optional and only enforce its value via Event System if any of the other two are set (basically you will be doing the mandatory check... but only if the others are set).

1
  • 1
    I tried removing it from the source tab. But even then, when you return to your form view of your component it will recreate this node.
    – Kah Tang
    Commented Jul 15, 2015 at 9:15

Your Answer

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

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