I am working on a customization where we want to update field2
when a value is selected in field1
. Field1
is a component link field and field2
will have template dropdown based on field1
component schema.
I am thinking to use event system but I can not find a field change event which I can subscribe to. Is there any?
If there isn't such event which I can subscribe to then I guess I will have to use custom URL for field2
. Are there any other options than custom URL which will be fit here?
-
You have tagged your question with event-system (.NET event handlers) and custom-url, but reading the description I think it is more about UI extensions on the CME. Maybe you can edit your question and provide a bit more detail about what type of customizxation you are working on, so you will be able to get better answers.– Bart KoopmanCommented Jul 11, 2017 at 7:27
-
Yes @BartKoopman, a UI extension will also work.– Rakesh ChoudharyCommented Jul 11, 2017 at 10:55
2 Answers
You could consider [[removed:OOTB]] Supported category use with the Tree View. The user would select from the top-down and the field populated with the final select.
Of course, by supported I mean without having to provide a custom extension - to add them is a content job; you could initially do this as a manual process and then automate the creation/update of schema/templates later).
If you wanted to remove the manual effort of managing the keywords - you could query the core service to map these relationships and populate the drop-down lists automagically. With the exception of your custom extension directly, this (the management of your selections) would still be considered supported as you're not extending anything in the context of managing keywords - and in terms of the custom GUI extension, you're simply using the APIs and general frameworks provided.
Of course, you could manage a mapping file as a deployed file if you chose - but this at the cost of maintenance and deployment (even for a template name change) - I would look to manage the values/relationships through the API or content editors as much as possible.
Two points (if you use Categories/Keywords):
- Be wary of duplicated IDs (say, you had London in CA and UK - I'd use the IDs caLon and ukLon etc.)
- Accepting the requirement may include "leaving the Country/State visible also" - which wouldn't be OOTB - then I expect your GUI extension would be much simpler by way of simply parsing the category/abstract keyword/keyword selection and putting to the screen.
Of course, you could go all out Full Metal Jacket on this - here you'd take the approach documented by Jamie - How to populate the dropdown in component editing screen using anguilla framework?
-
I do not have templates as keywords so I cant use the OOTB category with the Tree View. Commented Jul 11, 2017 at 11:02
-
Updating the keywords would still mean you're providing a supported (as opposed to OOTB) solution which is usually the first approach to explore. Commented Jul 11, 2017 at 14:35
-
@RakeshChoudhary - did you get a way forward for this? What was it? Commented Jul 14, 2017 at 11:27
-
Still deciding but looks like I will go with GUI extension with Anguilla Framework. Commented Jul 17, 2017 at 11:03
There is no event for Field Change. You need to have a custom URL only, in order to select a value in field2
based on the value selected in field1
.