use "nillable" in schema file and xsi:nil="true" in xml file, but it is ignored by XForms extention

RESOLVED WONTFIX

Status

RESOLVED WONTFIX
12 years ago
2 years ago

People

(Reporter: cjd0659, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

12 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a4pre) Gecko/20070411 Minefield/3.0a4pre
Build Identifier: firefox 2.0.0.3 with xforms extention 0.7.0.1 (I tried XForms 0.8 build 20070411 with minefield 3.0a4pre and the bug is there all the same)

hi everyone, 
I am a Mozilla fireforx XForms Extention 0.7.0.1 & 0.8 user in China. 
Forgive my poor English.
I got a problem about "nillable" attribute in schema file for my XForms application.
smaug told me that I should raise this problem as a bug report.
I want to make an element which is "nillable"(in schema file) and 
add xsi:nil="true" in the xml file. What I mean is the element is an integer
or empty when displayed or edited. But the firefox browser told me that all
the null value of the element is invalid. I tried in X-smiles and formsplayer and
they all work as expected.

Reproducible: Always

Steps to Reproduce:
1.save the content below to a.xhtml:
<html
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:xf="http://www.w3.org/2002/xforms" 
 xmlns:tr="http://www.taoroad.com/XMLSchema" 
 xmlns:ev="http://www.w3.org/2001/xml-events" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
   <head>
      <title>XForms inputs with labels</title>
      <style> 
@namespace xforms url(http://www.w3.org/2002/xforms);
.invalid, xforms|*:invalid { background-color: red; border-style: double;}
      </style>
      <xf:model schema="a.xsd">
         <xf:instance id="default_ins">
          	<p1:Element-1 xmlns:p1="http://www.taoroad.com/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
						    <p1:child1 xsi:nil="true"/>
						    <p1:child2>-2147483648</p1:child2>
						</p1:Element-1>
         </xf:instance>
         <xf:submission action="http://xformstest.org/cgi-bin/showinstance.sh" method="post" id="submitOrder" ref="instance('default_ins')"/>
      </xf:model>
   </head>
   <body>
         <xf:input ref="instance('default_ins')/tr:child1" incremental="true">
            <xf:label>input child1's value: </xf:label>
         </xf:input>
          <xf:input ref="instance('default_ins')/tr:child2" incremental="true">
            <xf:label>input child2's value: </xf:label>
         </xf:input>
         <br/>
         <xf:submit submission="submitOrder">
					<xf:label>submit</xf:label> 
				</xf:submit>
   </body>
</html>

2.save the content below to a.xsd:
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://www.taoroad.com/XMLSchema" 
xmlns:tr="http://www.taoroad.com/XMLSchema"
xmlns="http://www.taoroad.com/XMLSchema" 
elementFormDefault="qualified">
        <xsd:element name="Element-1">
            <xsd:complexType>
                <xsd:sequence>
                    <xsd:element name="child1" type="xsd:integer" nillable="true"/>
                    <xsd:element name="child2" type="xsd:int"/>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:element>
</xsd:schema>

3.open a.xhtml with Firefox 2.0.0.3 or Minefielda4pre, you will see the red 
background with child1's input, which meaning that the tag of <p1:child1 xsi:nil="true"/> is invalid. That's unexpected.
Actual Results:  
when a.xhtml opened by Firefox 2.0.0.3 or Minefielda4pre, you will see the 
red background with child1's input, which meaning that the tag of <p1:child1 xsi:nil="true"/> is invalid.

Expected Results:  
when a.xhtml opened by Firefox 2.0.0.3 or Minefielda4pre, you should see the 
white background with child1's input, which means that the tag of <p1:child1 xsi:nil="true"/> is valid. And when input any value, there should be a red background showing that the value violate the xsi:nil="true" tag.

From the a.xsd you can find that I want to get a /Element-1/child1 element which is nillable,
From the a.xhtml you can find that the instance "default_ins" which have the valid content:
<pre>
<p1:Element-1 xmlns:p1="http://www.taoroad.com/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<p1:child1 xsi:nil="true"/>
	<p1:child2>-2147483648</p1:child2>
</p1:Element-1>
</pre>

But when a.xhtml is displayed by firefox 2.0.0.3 with xforms extention 0.7.0.1 or Minefield(3.0a4pre) with XForms extention 0.8
the input box(child1) got a red background(by CSS) and users are not allowed to submit data to http://xformstest.org/cgi-bin/showinstance.sh.
I tried the the code in formsPlayer and xsmiles and they all worked as expected. 
What is expected is: when child1's input is empty, the background is white;
                     and when the child1's input got some value such as "1", it will got a red background and no action are performed when "submit" are clicked.
Is this a bug of Mozilla XForms or my misuse of "nillable"?
Appreciate for any reply from you!
my e-mail:cjd0659@gmail.com; cjd0659@126.com; cjd0659@msn.com; cjd0659@sina.com; cjd0659@gmail.com
RIP xforms
Status: UNCONFIRMED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → WONTFIX
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.