"Initial Value" and "Initial Instance" doesn't work in combination

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

"Initial Value" and "Initial Instance" doesn't work in combination

lacco
Hi,

I am "feeding" new forms with a POSTed initial instance (oxf.fr.detail.new.accept-post setting) so that parts of the forms are prefilled. In addition to this static data (e.g. a name), I would like to use the "Initial Value" property of the form runner or rather the xxforms:default attribute (e.g. with 'current-date()'). But this attribute doesn't have any effect in combination with POSTing the initial instance - is this a bug or is this supposed not to work?

Thank you!


Initial instance doc: http://wiki.orbeon.com/forms/doc/developer-guide/configuration-properties/configuration-properties-form-runner#TOC-Initial-instance
Initial value doc: http://www.orbeon.com/orbeon/doc/reference-xforms-extensions#xxforms-default-mip
Reply | Threaded
Open this post in threaded view
|

Re: "Initial Value" and "Initial Instance" doesn't work in combination

lacco
I spent now several hours on making initial instances and default values working together. My current solution is invoking the action "recalculate" with a new attribute "forceRecalculateDefaults=true" after having inserted the POSTed instance. Although this patch is only a few lines, I don't think is the best one - any nicer solutions are welcome! If there is nothing better, I would appreciate to integrate it into the core.

persistence_model.xml:
<xforms:insert nodeset="xxforms:instance('fr-form-instance')" origin="$xml-data"/>
+ <xforms:rebuild model="fr-form-model"/>
+ <xforms:recalculate forceRecalculateDefaults="true" model="fr-form-model"/>
+ <xforms:revalidate model="fr-form-model"/>
+ <xforms:refresh model="fr-form-model"/>
http://gist.github.com/407394

Reply | Threaded
Open this post in threaded view
|

Re: Re: "Initial Value" and "Initial Instance" doesn't work in combination

Erik Bruchez
Administrator
Iacco,

We discussed this and adding an attribute to xforms:recalculate to
force the re-evaluation of initial values sounded like a good idea. So
we implemented that, in a way similar to your patch:

http://github.com/orbeon/orbeon-forms/commit/61c8eed002964c4b6dd024b364fd3e3644e74d1c

We called the boolean attribute xxforms:defaults, and it can be an AVT.

See some documentation here:

http://wiki.orbeon.com/forms/doc/developer-guide/xforms-validation-and-mips#TOC-Forcing-recalculation-of-initial-va

Remains the Form Runner feature. We are not yet sure we need to
integrate this in Form Runner, since both cases can make sense:
sending initial data with and without re-evaluating initial values.
For that one you can maybe keep a local patch for now.

-Erik

On Thu, May 20, 2010 at 2:40 AM, lacco <[hidden email]> wrote:

>
> I spent now several hours on making initial instances and default values
> working together. My current solution is invoking the action "recalculate"
> with a new attribute "forceRecalculateDefaults=true" after having inserted
> the POSTed instance. Although this patch is only a few lines, I don't think
> is the best one - any nicer solutions are welcome! If there is nothing
> better, I would appreciate to integrate it into the core.
>
> persistence_model.xml:
>
>
>> <xforms:insert nodeset="xxforms:instance('fr-form-instance')"
>> origin="$xml-data"/>
>> + <xforms:rebuild model="fr-form-model"/>
>> + <xforms:recalculate forceRecalculateDefaults="true"
>> model="fr-form-model"/>
>> + <xforms:revalidate model="fr-form-model"/>
>> + <xforms:refresh model="fr-form-model"/>
>>
>
> http://gist.github.com/407394
>
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Initial-Value-and-Initial-Instance-doesn-t-work-in-combination-tp2218897p2224195.html
> Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws