Saving a date field that was initialized

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

Saving a date field that was initialized

wlau
Hi all,

I have a field of type date that I've inisialized with the value "current-date()". This works correctly. But, I've noticed two problems :
- Under form runner, when I save my form after modifying the value of this date field the value is still equal to the current date (in the saved form).
- When I send my form to alfresco, the value saved for this field in the pdf file is also still equal to the current date.

Is this a known bug ? Do you have a solution for this two problems ?

I didn't noticed these issues with a date field that wasn't initialized.

I'm using the 3.9.1 PE version.

Thanks for your answers.
Reply | Threaded
Open this post in threaded view
|

Re: Saving a date field that was initialized

Alessandro  Vernet
Administrator
Hi Wafa,

How did you initialize the field? Did you set its "Initial Value" in Form Builder? If you did, then the value is only set when the form is created. If you then reload and save the same data, the value set earlier won't change, which seems to be the behavior you observe.

If you use the Calculated Value instead, the value will be recalculated when needed, but on the flip side, you most likely won't want to make the field editable, as otherwise a value entered by users will be immediately overwritten.

Alex


On Mon, Jan 14, 2013 at 9:07 AM, wlau <[hidden email]> wrote:
Hi all,

I have a field of type date that I've inisialized with the value
"current-date()". This works correctly. But, I've noticed two problems :
- Under form runner, when I save my form after modifying the value of this
date field the value is still equal to the current date (in the saved form).
- When I send my form to alfresco, the value saved for this field in the pdf
file is also still equal to the current date.

Is this a known bug ? Do you have a solution for this two problems ?

I didn't noticed these issues with a date field that wasn't initialized.

I'm using the 3.9.1 PE version.

Thanks for your answers.



--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Saving-a-date-field-that-was-initialized-tp4656185.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




--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Saving a date field that was initialized

wlau
This post was updated on .
Hi Alex,

To initialize the field, I set its "Initial Value" in Form Builder with the xpath expression current-date().
Currently, when I set my field with "Initial Value" in Form Builder the value set won't change (see the two cases that I've mentioned above). And, when I set it with "Calculated Value" users won't be able to edit it.
What do I have to do to be able to initialize my date field with the current date (in form builder), make it editable for users and modifiable when saving it ?

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Saving a date field that was initialized

Alessandro  Vernet
Administrator
Hi Wafa,

The question is: when do you want the date to be set to the current date? Every time they open the form in their browser? So if they created the form on Jan 16, save it, and reopen it the next day, the date will show Jan 17, even if they never set it to Jan 17 and the value was Jan 16 the last time they saved it?

This is the rational being the "initial value": this value is computed and set only when a new form is created. And calculated values are constantly maintained, so it doesn't make sense for a user to change them, otherwise their change might be immediately overridden.

Alex


On Wed, Jan 16, 2013 at 12:58 AM, wlau <[hidden email]> wrote:
Hi Alex,

To initialize the field I set its "Initial Value" in Form Builder with the
xpath expression current-date().
Currently, when I set my field with "Initial Value" in Form Builder the
value set earlier won't change (see the two cases that I've mentioned
above). And, when I set it with "Calculated Value" users won't be able to
edit it.
What do I have to do to be able to initialize my date field with the current
date (in form builder) and make it editable for users ?

Thanks in advance.




--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Saving-a-date-field-that-was-initialized-tp4656185p4656191.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




--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Saving a date field that was initialized

wlau
Hi Alex,

Yes, I want the date to be set to the current date every time they open the form in their browser. That's why I am using the expression "current-date()" as initial value.
The rational being of the "initial value" is of course that the value is computed and set when a new form is created. This is logical and represents what I need.
But what is not rational is that when I modify the value and save the form, the value saved is not what I've edited but the value of the current date.
For instance, I open the form in their browser. The date field is set to Jan 21 (which is OK). I change the value into Feb 27 and than save my form. Than I open the "summary" view in form runner to see the datas I've had saved. The result is : the value saved is not "Feb 27" but stills "Jan 21".
I've noticed the same issue when sending my form to alfresco, the value saved for this field in the pdf file is also still equal to the current date.

Thanks in advance for your answers.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Saving a date field that was initialized

Alessandro  Vernet
Administrator
Hi Wafa,

I don't quite understand in which use case this would make sense, but you can do this by editing the source and adding the following inside the <xforms:model id="fr-form-model">:

<xforms:setvalue ev:event="xforms-ready" ref="xxforms:bind('date-bind')" value="current-date()"/>

This assumes that name of you date control is "date". If it isn't, change the parameter to xxforms:bind(). In essence, it is the name of your control with "-bind" concatenated.

Alex


On Mon, Jan 21, 2013 at 6:40 AM, wlau <[hidden email]> wrote:
Hi Alex,

Yes, I want the date to be set to the current date every time they open the
form in their browser. That's why I am using the expression "current-date()"
as initial value.
The rational being of the "initial value" is of course that the value is
computed and set when a new form is created. This is logical and represents
what I need.
But what is not rational is that when I modify the value and save the form,
the value saved is not what I've edited but the value of the current date.
For instance, I open the form in their browser. The date field is set to Jan
21 (which is OK). I change the value into Feb 27 and than save my form. Than
I open the "summary" view in form runner to see the datas I've had saved.
The result is : the value saved is not "Feb 27" but stills "Jan 21".
I've noticed the same issue when sending my form to alfresco, the value
saved for this field in the pdf file is also still equal to the current
date.

Thanks in advance for your answers.



--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Saving-a-date-field-that-was-initialized-tp4656185p4656196.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




--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Saving a date field that was initialized

wlau
Hi,

Thanks for this answer but the solution you proposed gives the same result as setting the intial value of the control to "current-date()" :
When I open the form in the browser the value is in fact set to "07/02/2013" but when I modify it (for exemple to "25/02/2013") and then save, the result is : the value saved is "07/02/2013" and not "25/02/2013".
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Saving a date field that was initialized

Alessandro  Vernet
Administrator

Hi Wafa,

How are you checking that the date isn't saved properly? Are you looking at the data directly in the database? Because of course, of you re-open the form, it will be reset to the current date, per my understanding of your requirement.

Alex

On Feb 7, 2013 2:23 AM, "wlau" <[hidden email]> wrote:
Hi,

Thanks for this answer but the solution you proposed gives the same result
as setting the intial value of the control to "current-date()" :
When I open the form in the browser the value is in fact set to "07/02/2013"
but when I modify it (for exemple to "25/02/2013") and then save, the result
is : the value saved is "07/02/2013" and not "25/02/2013".



--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Saving-a-date-field-that-was-initialized-tp4656185p4656246.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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet