logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: Interpretation issue: Required vs. Type in Binds: msg#00052

Subject: Re: Interpretation issue: Required vs. Type in Binds
Paul Miniato wrote:

Hi Joern,

your suggestion about initializing optional non-string fields to
something like 0 may be our other solution.  It's not too
unreasonable for numbers, but it's a little harder to come up with
the non-date date.  :-(
yes. right. also stumbled about that.

that's why your suggestion might make sense even for the (Schema-supported) future.

Joern

I'll wait to see what others might have to say.

Paul M


From: joern turner wrote

Hello again,

Paul Miniato wrote:


Hi again,

Many types, as used in the xf:type attribute of the xf:bind
element do not allow empty strings in their data space.

At present this means that, if a data element with bind
constraints that specify types such as decimal or date is not
required, it is still not possible to leave the field completely
blank without getting an error.

The XForms spec at < http://www.w3.org/TR/xforms/slice6.html#model-xformsconstraints >
 doesn't really get into this issue of whether the

xf:required="false"

attribute should cause an empty string to be acceptable in this field. But, I will point out that without this, many of these
types are useless when used with optional fields.

you've brilliantly summarized an issue which we also discussed on
the list some month ago with Sophie in context of Schema2XFormsBuilder tool. - and as i have to state without
actually resolving the issue. as you've mentioned the spec isn't
really enlightening here - the handling of schema optional elements
isn't really specified.

part of the problem is surely Chiba itself not handling the Schema
types correctly. to be consistent with XML Schema IMO XForms should
 explicitly require that optional (not required) elements are
initialized with their equivalent to the empty type e.g. '0' for
integer or some other specified default. at least this would
consistently setup the complete instance at once and avoid trouble
with optional elements becoming required through some calculation.
Cause Chiba simply uses strings here it's part of the problem by
now.

Nevertheless the spec leaves gaps here that have to be filled to
get a running system.


My initial expectation (and still my hope) is that xf:required="false" should suppress any type checking if the
element is empty.  What do you think of this?

this might be a solution. at least until we have a real Schema
support. (it's highest priority on our todo list)

other opinions around? please speak up.

Joern


(You might think that any explicit xf:constraint might also need
to be relaxed if the field is not required and blank, but this
can always be explicitly allowed for in the constraint XPath.)

Sample attached.

Thanks, Paul M

Paul Miniato Standard Forms Project < http://ecommerce.cucbc.com/
>

<<requiredIssue.xml>>





-------------------------------------------------------------- ----------


<?xml version="1.0" encoding="ISO-8859-1"?> <html xmlns="http://www.w3.org/2002/06/xhtml2"; xmlns:xf="http://www.w3.org/2002/xforms"; xmlns:ev="http://www.w3.org/2001/xml-events"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:xsd="http://www.w3.org/2001/XMLSchema"; xmlns:chiba="http://chiba.sourceforge.net/2003/08/xforms"; >

<head> <xf:model id="model1"> <xf:submission id="submit1" xf:action="http://localhost:8080/chiba-0.9.5/jsp/debug-instance.jsp";
 xf:method="post" xf:replace="all"/>

<xf:instance> <top> <data1></data1> <data2></data2> </top> </xf:instance>

<xf:bind id="data1" xf:nodeset="/top/data1" xf:type="decimal" xf:required="true()"/> <xf:bind id="data2"
xf:nodeset="/top/data2" xf:type="decimal" xf:required="false()"/>
</xf:model> </head>

<body> <xf:group> <xf:input bind="data1"> <xf:label>Required decimal</xf:label> <xf:alert>Required decimal alert</xf:alert> </xf:input>

<xf:input bind="data2"> <xf:label>Optional decimal</xf:label> <xf:alert>Optional decimal alert</xf:alert> </xf:input>

<xf:submit submission="submit1"> <xf:label>Test Submit</xf:label>
 </xf:submit> </xf:group> </body> </html>






-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click


<Prev in Thread] Current Thread [Next in Thread>