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

RE: How best to do a once only calculation?

From: Kugelman, John <jkugelman@progeny.net>
Date: Tue, 6 Jun 2006 13:04:42 -0400
Message-ID: <9A0E40933DE3E548A1B8E32063CE4EE482B3EB@es3.progeny.net>
To: "Mark Birbeck" <mark.birbeck@x-port.net>, <www-forms@w3.org>


Are there any plans to add a @default attribute? It seems like an
obvious thing to do, given this clunky workaround. (No knock against
you, Mark, of course! It's a clever use of existing mechanics.)


-----Original Message-----
From: www-forms-request@w3.org [mailto:www-forms-request@w3.org] On
Behalf Of Mark Birbeck
Sent: Tuesday, June 06, 2006 11:56 AM
To: www-forms@w3.org
Subject: RE: How best to do a once only calculation?


What you're after is much like a 'default' value, which XForms doesn't
support, but can be emulated like this:

   calculate="if(string(text()) = '', now(), text())"

To use this 'default' technique more generally, so that your form users
also edit the value, make sure that the readonly MIP is disabled:

   calculate="if(string(text()) = '', 1, text())"



Mark Birbeck
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
b: http://internet-apps.blogspot.com/
w: http://www.formsPlayer.com/

Download our XForms processor from

> -----Original Message-----
> From: www-forms-request@w3.org 
> [mailto:www-forms-request@w3.org] On Behalf Of Flinton Adam
> Sent: 06 June 2006 16:09
> To: www-forms@w3.org
> Subject: How best to do a once only calculation?
> We have a need to put in a date generated when you construct 
> the form as such I have looked at
> <xforms:bind nodeset="Date_begun" id="Date_begun" type="xsd:dateTime"
> calculate="now()" />
> However rather obviously it will do this everytime I open 
> this element/form.
> We have an element which can carry a value which we are using 
> to denote if something is new (i.e. should have the date 
> now() generated) or already existing i.e. it should be left as is.
> Any ideas?
> Adam
> This e-mail is confidential and privileged. If you are not 
> the intended recipient please accept our apologies; please do 
> not disclose, copy or distribute information in this e-mail 
> or take any action in reliance on its contents: to do so is 
> strictly prohibited and may be unlawful. Please inform us 
> that this message has gone astray before deleting it. Thank 
> you for your co-operation.
Received on Tuesday, 6 June 2006 17:06:07 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:17 UTC