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

RE: How best to do a once only calculation?

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Tue, 6 Jun 2006 16:56:03 +0100
To: <www-forms@w3.org>
Message-ID: <036401c68981$b7aca7d0$6502a8c0@Jan>

Adam,

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

  <xforms:bind
   nodeset="Date_begun"
   id="Date_begun"
   type="xsd:dateTime"
   calculate="if(string(text()) = '', now(), text())"
  />

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

  <xforms:bind
   nodeset="how-many-pizzas"
   calculate="if(string(text()) = '', 1, text())"
   readonly="false()"
  />

Regards,

Mark


Mark Birbeck
CEO
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
http://www.formsPlayer.com/

> -----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?
> 
> TIA
> 
> 
> 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 15:56:29 GMT

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