AnsweredAssumed Answered

Web Form - Required Child Elements in Optional Parent

Question asked by buck_99 on Oct 30, 2008
Latest reply on Nov 25, 2008 by samwise

I have a parent element that is not required.  Iff the parent element is present, then one of its children is required.  Alfresco won't allow me to get past to step 3 of the Create Web Content wizard because I am leaving the required child field empty, although it is my intention to leave the whole parent empty. 


- Scott

Here is the schema.  Relevant sections have been highlighted:

<?xml version="1.0"?>
<xs:schema xmlns:xs=""

  <!– Department –>
  <xs:simpleType name="department">
    <xs:restriction base="xs:normalizedString">
      <xs:enumeration value="Accounts Payable"/>
      <xs:enumeration value="Communications"/>
      <xs:enumeration value="Finance"/>
      <xs:enumeration value="Human Resources"/>
      <xs:enumeration value="IT and Help Desk"/>
      <xs:enumeration value="Payroll"/>
      <xs:enumeration value="Purchasing"/>
      <xs:enumeration value="Records and Archives"/>
      <xs:enumeration value="Travel"/>

  <!– Category –>
  <xs:simpleType name="category">
    <xs:restriction base="xs:normalizedString">
      <xs:enumeration value="Mission"/>
      <xs:enumeration value="Contact"/>
      <xs:enumeration value="Announcement"/>
      <xs:enumeration value="Upcoming Event"/>
  <!– Image Size –>
  <xs:simpleType name="size">
    <xs:restriction base="xs:normalizedString">
      <xs:enumeration value="Small"/>
      <xs:enumeration value="Medium"/>
      <xs:enumeration value="Large"/>
  <!– Image Alignment –>
  <xs:simpleType name="alignment">
    <xs:restriction base="xs:normalizedString">
      <xs:enumeration value="Left"/>
      <xs:enumeration value="Center"/>
      <xs:enumeration value="Right"/>
  <!– News body section:  repeatable element –>
  <xs:complexType name="section">
      <xs:element name="image" type="bc:image" nillable="true"/> <!– also tried minOccurs="0" maxOccurs="1" –>
      <xs:element name="text" type="xs:string" minOccurs="1" maxOccurs="1"/>
  <!– Image info:  file location, size, and alignment –>
  <xs:complexType name="image">
        <xs:element name="file" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/> <!– Child element: required if parent exists –>
        <xs:element name="size" type="bc:size" default="Small" minOccurs="1" maxOccurs="1"/>
        <xs:element name="alignment" type="bc:alignment" default="Left" minOccurs="1" maxOccurs="1"/>
  <!– defines the form for creating a news story –>
  <xs:element name="basic-content">
        <xs:element name="title" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
        <xs:element name="abstract" type="xs:normalizedString" minOccurs="1" maxOccurs="1"/>
        <xs:element name="date_added" type="xs:date"/> <!– How to put current date as default? –>
        <xs:element name="bodySection" type="bc:section" minOccurs="1" maxOccurs="unbounded"/>
        <xs:element name="keywords" type="xs:normalizedString" minOccurs="0" maxOccurs="1"/>
      <xs:element name="department" type="bc:department" default="HHMI Company-wide"/>
      <xs:element name="category" type="bc:category"/>
      <xs:element name="launch_date" type="xs:date" minOccurs="0" maxOccurs="1"/>
      <xs:element name="expiration_date" type="xs:date" minOccurs="0" maxOccurs="1"/>