cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove mandatory option

balaji_r
Champ in-the-making
Champ in-the-making
Hi all,

I have created web form using alfresco labs3 to get the person details, which has 5 fields like name,age,phone number,address,education. In this i don't want to get person education details, so i want to make that as non mandatory field , how to do that?
7 REPLIES 7

scottf
Champ on-the-rise
Champ on-the-rise
Adding a "minOccurs=0" attribute should solve this for you.

Something like:

<xs:element name="keywords" type="xs:normalizedString" minOccurs="0"/>

Hope that helps.

balaji_r
Champ in-the-making
Champ in-the-making
Thanks ScottF,

It worked well..

balaji_r
Champ in-the-making
Champ in-the-making
Hi ScottF,

Suppose i have the field like

<xs:element name="phone" type="xs:integer"  minOccurs="1" maxOccurs="3"/>

How to make this as non mandatory ?

scottf
Champ on-the-rise
Champ on-the-rise
No problem glad it helped.

To answer your second question, simply change minOccurs="1" to minOccurs="0".

So your line would then be:
<xs:element name="phone" type="xs:integer" minOccurs="0" maxOccurs="3"/>

balaji_r
Champ in-the-making
Champ in-the-making
Thanks again ScottF..its working fine..

balaji_r
Champ in-the-making
Champ in-the-making
Hi ScottF,

Again one more problem on mandatory conditions,


<xs:complexType name="qualification">
<xs:sequence>
<xs:element name="UG" type="pr:UG" minOccurs="1" maxOccurs="2"/>
</xs:sequence>
</xs:complexType>

<xs:complexType name="UG">
<xs:sequence>
    <xs:element name="board" type="xs:normalizedString"/>
    <xs:element name="marks" type="xs:integer"/>
    <xs:element name="yearOfPassing" type="xs:gYear"/>
</xs:sequence>
</xs:complexType>


<xs:element name="Person">
   <xs:complexType>
   <xs:sequence>
                <xs:element name="name" type="xs:normalizedString"/>
            <xs:element name="age" type="xs:integer" minOccurs="0" />
          <xs:element name="educationDetails" type="pr:education" minOccurs="1" maxOccurs="1"/>
               </xs:sequence>
              </xs:complexType>
</xs:element>


In these schema , the UG degree comes twice, for the first time it should be mandatory and the next time non mandatory , how i acheive that, pls help me out

And one more question when you click (+) button on UG , for the first time it comes blank for all the field but the second time it load "null" in the yearofpassing field. How to remove "null " in the yearofpassing field.

scottf
Champ on-the-rise
Champ on-the-rise
Hi,
Sorry I really don't know the answer to this one, I hope someone else on this forum might be able to help you.