W3C home > Mailing lists > Public > www-forms@w3.org > June 2005

RE: Optional attributes in instance.

From: John Boyer <JBoyer@PureEdge.com>
Date: Fri, 10 Jun 2005 09:06:52 -0700
Message-ID: <7874BFCCD289A645B5CE3935769F0B527508C7@tigger.pureedge.com>
To: <jeacott@hardlight.com.au>, <www-forms@w3.org>

Note that optional attribute support is not a lazy authoring issue.

Lazy authoring happens when you don't have any instance at all.  But if
you have an instance, then you * don't * receive the behavior that non-existing
nodes referenced by single node UI binding get created.

This behavior does not happen because there is an alternate defined behavior.
The notion of an "optional" attribute is really just one way of saying that 
you have a single node binding that resolves to an empty nodeset.

If the single node binding of a form control resolves to empty nodeset,
then the control MUST behave as if it is bound to a non-relevant node.
Moreover, if something later causes that node to come into existence,
the control MUST automatically bind to it.

One problem is that it's a little unclear what you want.  You said that you 
want the @age if it's there and a default otherwise.  Does this mean that
if the @age is not there, then the user gets no input control and your forms
application uses a default setting?  If so, that's easy.

But I suspect you may mean that if @age is not there, then you want to present 
to the user an input control set with a default value? And if they change it, 
then the @age attribute is created and given the value?  

That sounds a lot harder; not sure offhand that it's possible with XForms 1.0 
(it will be in 1.1, though).

Cheers,
John Boyer, Ph.D.
Senior Product Architect and Research Scientist
PureEdge Solutions Inc.

-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org]On
Behalf Of Jason Eacott
Sent: Friday, June 10, 2005 6:51 AM
To: www-forms@w3.org
Subject: Re: Optional attributes in instance.



Chiba doesn't deal at all well with attributes that may or may not 
exist.
if you bind something to an attribute and its not there Chiba will 
complain loudly.
it doesn't implement the whole lazy authoring thing in this case.
(at least it didn't in v1.0, maybe they've fixed that now?)
I found a workaround but it was messy and involved serverside xsl to
restore missing attributes & elements with dummy's just so that the xform
would remain functional during multiple submission/instance reload cycles
where relevant="false" would cull my instance data which could not then be
reloaded directly. this whole aspect of xforms really needs to be
addressed. There are issues here. A particularly nasty side effect of
submiting data whilst you might be using relevant to hide aspects of the
UI actually culls your data - not always ideal!

Regards
Jason.





Date sent:      	Fri, 10 Jun 2005 14:26:12 +0400
From:           	Alexander Berezhnoy <alexander.berezhnoy@splc.ru>
To:             	www-forms@w3.org
Subject:        	Optional attributes in instance.
Forwarded by:   	www-forms@w3.org
Date forwarded: 	Fri, 10 Jun 2005 10:56:02 +0000

> 
> Hi,
> I've the following question:
> 
> For example, I have an instance like
> <person name="Ivan Ivanoff"/> and also "@age" which is the optional
> attribute of a <person> tag. I need to have an input element which is
> bound to person/@age and have some default value if the attribute is
> omitted in instance. My XForms engine (Chiba) ignores my <input> tag
> unless the @age is actually present (it just doesn't show the html
> input, but shows it's label). Is it possible to do so?
> 
> Thank you.
> 
> -- 
> Alexander Berezhnoy,
> Chief Architect
> SmartPhone Labs, LLC
> http://www.smartphonelabs.com
> 
> 
> 
Received on Friday, 10 June 2005 16:07:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:01 GMT