Re: How best to do a once only calculation?

Hi Adam,

You can for example add an even listener to your model that listens for 
the modelconstruct-done event and use a set value action to set the value.

<xforms:setvalue bind="Date_begun" value="now()" 
ev:event="xforms-model-construct-done"/>

Kind regards,

Nick Van den Bleeken  -  Research & Development
Inventive Designers
Phone: +32 - 3 - 8210170
Fax: +32 - 3 - 8210171
Email: Nick_Van_den_Bleeken@inventivedesigners.com

www-forms-request@w3.org wrote on 06/06/2006 05:09:05 PM:

> 
> 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.
> 
> 
> 



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

Inventive Designers' Email Disclaimer:

http://www.inventivedesigners.com/email-disclaimer

Received on Tuesday, 6 June 2006 18:54:29 UTC