[opencms-dev] How get widget class associated with a A_CmsXmlContentValue?

Sandrine Prousteau s.prousteau at eurelis.com
Wed Nov 5 15:55:37 CET 2008


Hi
I'm trying to get the widget class used with a CmsXmlContentDefinition,
in order to create a custom form field for a frontend form. I can get
some widget class doing this:

CmsXmlContentDefinition cmsXmlContentDefinition =
CmsXmlContentDefinition.unmarshal(cms, xsdPath);
I_CmsXmlSchemaType schemaType =
(I_CmsXmlSchemaType)cmsXmlContentDefinition.getSchemaType(xpath) ;
if(schemaType.isSimpleType()){
	I_CmsWidget widget =
contentHandler.getWidget((A_CmsXmlContentValue)schemaType);
	...

But when the content definition is for a element like:

<layout element="MyField" widget="MultiSelectWidget" 
					configuration="val1|val2" />
or
<layout element="MyField" widget="CategoryWidget" 
					configuration="..." />

the widget class seems to be CmsInputWidget, when I expected
CmsMultiSelectWidget and CmsCategoryWidget...
>From where is the problem?

I need this to test of which sort of content is my field, to generate
the field form associated, using the configuration of the widget.
Could you help me?



More information about the opencms-dev mailing list