AnsweredAssumed Answered

xsd Required fields based on Conditions

Question asked by jmamakes3 on Jul 9, 2007
I am new to Infopath and Sharepoint and trying to teach myself how to program!!

I am trying to make fields required when other fields meet a certain condition.  Any HELP would be appreciated :)


Such as when ref="my:New_Provider_or_Resource" minOccurs="0"/>
= Provider

then
<xsd:element name="Provider_Last_Name" type="xsd:string"/>
   <xsd:element name="Provider_First_Name" type="xsd:string"/>
   are required

but when ref="my:New_Provider_or_Resource" minOccurs="0"/>
= Resource

then
ref="my:Resource" minOccurs="0"/>   is Required


            
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xsd:schema targetNamespace="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-06-12T14:18:07" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2007-06-12T14:18:07" xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:element name="myFields">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="my:Basic_Info" minOccurs="0"/>
            <xsd:element ref="my:EpicCare" minOccurs="0"/>
            <xsd:element ref="my:Sched_Template_Section" minOccurs="0"/>
            <xsd:element ref="my:UserName" minOccurs="0"/>
            <xsd:element ref="my:Requester_Phone" minOccurs="0"/>
            <xsd:element ref="my:Today_Date" minOccurs="0"/>
            <xsd:element ref="my:Epic_Only" minOccurs="0"/>
         </xsd:sequence>
         <xsd:anyAttribute processContents="lax" namespace="http://www.w3.org/XML/1998/namespace'/>
      </xsd:complexType>
   </xsd:element>
   <xsd:element name="Basic_Info">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="my:New_Provider_or_Resource" minOccurs="0"/>
            <xsd:element ref="my:Provider_Last_Name" minOccurs="0"/>
            <xsd:element ref="my:Provider_First_Name" minOccurs="0"/>
            <xsd:element ref="my:Provider_Middle_Name" minOccurs="0"/>
            <xsd:element ref="my:Resource" minOccurs="0"/>
            <xsd:element ref="my:Professional_Title" minOccurs="0"/>
            <xsd:element ref="my:Gender" minOccurs="0"/>
            <xsd:element ref="my:Fellow_Res_No" minOccurs="0"/>
            <xsd:element ref="my:External_Name" minOccurs="0"/>
            <xsd:element ref="my:Specialties" minOccurs="0"/>
            <xsd:element ref="my:Languages_Spoken" minOccurs="0"/>
            <xsd:element ref="my:TX_State_Board_License" minOccurs="0"/>
            <xsd:element ref="my:UPIN" minOccurs="0"/>
            <xsd:element ref="my:NPI" minOccurs="0"/>
            <xsd:element ref="my:EpicCare_Doc_Msg" minOccurs="0"/>
            <xsd:element ref="my:EpicCare_User" minOccurs="0"/>
            <xsd:element ref="my:Scheduling_Template" minOccurs="0"/>
            <xsd:element ref="my:Employee_Start_Date_Section" minOccurs="0"/>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>
   <xsd:element name="New_Provider_or_Resource" type="xsd:string"/>
   <xsd:element name="Provider_Last_Name" type="xsd:string"/>
   <xsd:element name="Provider_First_Name" type="xsd:string"/>
   <xsd:element name="Provider_Middle_Name" type="xsd:string"/>
   <xsd:element name="Resource" type="xsd:string"/>
   <xsd:element name="Professional_Title" type="xsd:string"/>
   <xsd:element name="Gender" type="xsd:string"/>
   <xsd:element name="Fellow_Res_No" type="xsd:string"/>
   <xsd:element name="External_Name" type="xsd:string"/>
   <xsd:element name="Specialties" type="xsd:string"/>
   <xsd:element name="Languages_Spoken" type="xsd:string"/>
   <xsd:element name="TX_State_Board_License" type="xsd:string"/>
   <xsd:element name="UPIN" type="xsd:string"/>
   <xsd:element name="NPI" type="xsd:string"/>
   <xsd:element name="EpicCare_User" type="xsd:string"/>
   <xsd:element name="Scheduling_Template" type="xsd:string"/>
   <xsd:element name="Employee_Start_Date_Section">
      <xsd:complexType>
         <xsd:sequence>
            <xsd:element ref="my:Start_Date" minOccurs="0"/>
         </xsd:sequence>
      </xsd:complexType>
   </xsd:element>
   <xsd:element name="Start_Date" nillable="true" type="xsd:date"/>

Outcomes