Creating drop down in wcm form.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2007 04:12 PM
Hi,
I want to creat a drop down in my wcm form. I was looking at the wcm examples, it has sample code(press_release.xsd) which creates drop down like:
<xs:simpleType name="category">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="Product"/>
<xs:enumeration value="Partnership"/>
<xs:enumeration value="Company"/>
<xs:enumeration value="Event"/>
<xs:enumeration value="Training"/>
</xs:restriction>
</xs:simpleType>
and the using it like,
<xs:element name="category" type="pr:category" default="Company"/>
But when i try like:
<xs:simpleType name="job_type">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="FullTime Employee"/>
<xs:enumeration value="Contractor"/>
<xs:enumeration value="Temp to Permanent"/>
</xs:restriction>
</xs:simpleType>
and call it like
<xs:element name="job_type" type="pr:job_type"/>
it creates radio button not drop down. Can any body help me out?
Is something defined in the alfresco nameSpace for "pr:category" tag, and because of that reason i am not able to create drop down.Please help, if anybody has done something like this.
Thanks!
I want to creat a drop down in my wcm form. I was looking at the wcm examples, it has sample code(press_release.xsd) which creates drop down like:
<xs:simpleType name="category">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="Product"/>
<xs:enumeration value="Partnership"/>
<xs:enumeration value="Company"/>
<xs:enumeration value="Event"/>
<xs:enumeration value="Training"/>
</xs:restriction>
</xs:simpleType>
and the using it like,
<xs:element name="category" type="pr:category" default="Company"/>
But when i try like:
<xs:simpleType name="job_type">
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="FullTime Employee"/>
<xs:enumeration value="Contractor"/>
<xs:enumeration value="Temp to Permanent"/>
</xs:restriction>
</xs:simpleType>
and call it like
<xs:element name="job_type" type="pr:job_type"/>
it creates radio button not drop down. Can any body help me out?
Is something defined in the alfresco nameSpace for "pr:category" tag, and because of that reason i am not able to create drop down.Please help, if anybody has done something like this.
Thanks!
Labels:
- Labels:
-
Archive
5 REPLIES 5

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2007 04:29 PM
Have you put the namespace at the top of your xsd
Try that and it should work
–Vijay
Try that and it should work
–Vijay
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2007 04:57 PM
Thanks for ur prompt reply.
Yes, i have put alfresco namespace at the top.
xmlns
r="http://www.alfresco.org/alfresco/pr"
targetNamespace="http://www.alfresco.org/alfresco/pr"
Still it doesnot work. any idea?
Yes, i have put alfresco namespace at the top.
xmlns

targetNamespace="http://www.alfresco.org/alfresco/pr"
Still it doesnot work. any idea?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2007 05:36 PM
Ok this may sound really wierd. But you need to have atleast 5 enumeration values to generate a drop down. Otherwise it generates radio buttons.
So to make this work you need to add another two values to
<xs:enumeration value="FullTime Employee"/>
<xs:enumeration value="Contractor"/>
<xs:enumeration value="Temp to Permanent"/>
Hope this helps.
Rukmini
So to make this work you need to add another two values to
<xs:enumeration value="FullTime Employee"/>
<xs:enumeration value="Contractor"/>
<xs:enumeration value="Temp to Permanent"/>
Hope this helps.

Rukmini
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2007 07:22 PM
Everyone:
If you want to force either radio buttons or a drop-down regardless of number of entries, you can use the appearance attributes of FULL for radio buttons and COMPACT for drop-down.
There's an example of list options in our source tree in /ROOT/projects/web-client/xforms/unit-tests/list.xsd. This is one of multiple example forms. These will be added to our 2.2 Enterprise package and be documented on our wiki this December. There are lots of great examples in this; for now, please check out our source tree.
Kevin
If you want to force either radio buttons or a drop-down regardless of number of entries, you can use the appearance attributes of FULL for radio buttons and COMPACT for drop-down.
There's an example of list options in our source tree in /ROOT/projects/web-client/xforms/unit-tests/list.xsd. This is one of multiple example forms. These will be added to our 2.2 Enterprise package and be documented on our wiki this December. There are lots of great examples in this; for now, please check out our source tree.
Kevin

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2009 07:08 AM
HI! All
I am also facing the similar problem. I have genrated a drop down klist in my xsd file through enumeration. The drop down gets generated but i am unable to select any value apart from the default value. If I dont give any ddefault value then I am getting mandatory field required error.
Please provide help on this if any one has done the similar thing. Please see the code below:
my-sample.xsd
The ftl file used to render is my-sample.ftl:
I am also facing the similar problem. I have genrated a drop down klist in my xsd file through enumeration. The drop down gets generated but i am unable to select any value apart from the default value. If I dont give any ddefault value then I am getting mandatory field required error.
Please provide help on this if any one has done the similar thing. Please see the code below:
my-sample.xsd
<?xml version="1.0"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:my_sample="http://www.alfresco.org/alfresco/my_sample" targetNamespace="http://www.alfresco.org/alfresco/my_sample" xmlns:alf="http://www.alfresco.org" elementFormDefault="qualified"><xs:element name="my_sample"> <xs:annotation> <xs:documentation source="ospi.label">my_sample_Title</xs:documentation> <xs:documentation source="ospi.description">my_sample_Desc</xs:documentation> </xs:annotation> <xs:complexType> <xs:sequence> <xs:element name="Language" type="my_sample:LanguageSelect" default="English"> <xs:annotation> <xs:appinfo> <alf:label>${Language}</alf:label> </xs:appinfo> </xs:annotation> </xs:element><xs:element name="Level1" minOccurs="1" fixed="Going to court" > <xs:annotation> <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation> <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:normalizedString" > <xs:maxLength value="20" fixed="true" /> </xs:restriction> </xs:simpleType></xs:element><xs:element name="Level2" minOccurs="1" fixed="Financial Claims"> <xs:annotation> <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation> <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:normalizedString"> <xs:maxLength value="20" fixed="true" /> </xs:restriction> </xs:simpleType></xs:element><xs:element name="Level3" minOccurs="1" fixed="Small Claims"> <xs:annotation> <xs:documentation source="ospi.label">TextFieldLabel</xs:documentation> <xs:documentation source="ospi.description">TextFieldLabelDesc</xs:documentation> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:normalizedString"> <xs:maxLength value="20" fixed="true" /> </xs:restriction> </xs:simpleType></xs:element><xs:element name="Roll_Over_Text" minOccurs="1"> <xs:annotation> <xs:documentation source="ospi.label">TextAreaLabel</xs:documentation> <xs:documentation source="ospi.description">TextAreaLabelDesc</xs:documentation> <xs:appinfo> <alf:appearance>minimal</alf:appearance> </xs:appinfo> </xs:annotation> <xs:simpleType> <xs:restriction base="xs:string"> <xs:maxLength value="100" fixed="true" /> </xs:restriction> </xs:simpleType></xs:element><xs:element name="Body_Content" type="xs:string" minOccurs= "1" maxOccurs="1"> <xs:annotation> <xs:appinfo> <alf:appearance>custom-styles-mce</alf:appearance> </xs:appinfo> </xs:annotation></xs:element><xs:element name="Link_Information" type="my_sample:linkInfo" minOccurs="1" maxOccurs="unbounded"/><xs:element name="Owner" type="xs:normalizedString" nillable="true"/><xs:element name="Owners_e_Mail_Id" type="xs:normalizedString" nillable="true"/> <xs:element name="Date_of_Expiry" type="xs:date"/> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="linkInfo"> <xs:sequence> <xs:element name="Link_Name" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/> <xs:element name="Link_URL" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/> <xs:element name="Link_Description" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:complexType> <xs:simpleType name="LanguageSelect"> <xs:restriction base="xs:normalizedString"> <xs:enumeration value="German"/> <xs:enumeration value="French"/> <xs:enumeration value="English"/> <xs:enumeration value="Spanish"/> <xs:enumeration value="Dutch"/> <xs:enumeration value="Belgian"/> <xs:enumeration value="Irish"/> </xs:restriction> </xs:simpleType></xs:schema>
The ftl file used to render is my-sample.ftl:
<#ftl ns_prefixes={"D":"http://www.alfresco.org/alfresco/my_sample','xsi':'http://www.w3.org/2001/XMLSchema-instance"}><HTML> <HEAD> <title>${my_sample.Level3} Page</title> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <link rel="stylesheet" type="text/css" href="/work/Attachments/ContentPageBasic.css" /> </HEAD> <BODY> <table border="0" width="100%" height="100%" cellpadding="3" cellspacing="0" border="0" ><tr><td align="left" valign="top" height="80%"> <div style="width:100%;height:100%;overflow:auto;"><table width="100%" height="100%" cellpadding="3" cellspacing="0" border="0" ><tr><td align="left" valign="top"><h2>${my_sample.Language}</h2></td></tr><tr><td align="left" valign="top">${my_sample.Level1} >> ${my_sample.Level2} >> ${my_sample.Level3}</td></tr><tr><td align="left" valign="top"><br>${my_sample.Roll_Over_Text}</td></tr><tr><td align="left" valign="top"><br>${my_sample.Body_Content}</td></tr></table></div></td></tr><tr><td align="left" valign="top"><hr align=left noshade size=5 width=100%></td></tr><tr><td align="left" valign="top" height="20%"><div style="width:100%;height:100%;overflow:auto;"><table width="100%" height="100%" cellpadding="3" cellspacing="0" border="0" ><tr><td align="left" valign="top"><h2>Related information</h2></td></tr><tr><td align="left" valign="top"><#list my_sample.Link_Information as parentLink> <li> <a href='${parentLink.Link_URL}' id='${parentLink.Link_Description}'>${parentLink.Link_Name}</a> </li> </#list></td></tr><tr><td align="left" valign="top">${my_sample.Owner}</td></tr><tr><td align="left" valign="top">${my_sample.Owners_e_Mail_Id}</td></tr><tr><td align="left" valign="top">${my_sample.Date_of_Expiry}</td></tr></table></div></td></tr></table> </BODY></HTML>
