//check if field has value and assign date if no value
if (fieldName.rawValue == null){
this.rawValue = new Date();
}
//assign current value if field has a value already
else {
this.rawValue = this.rawValue;
}
Actually on thinking about it the else may not be needed, I've just
always had it in there for some reason.
On Mar 23, 11:21 am, "Worst, Debbie" <dwo...@GAIC.COM> wrote:
> I have a date field that the user wants to default to "today". The problem I'm having is that on "initialize" is where I would put the code for the date to be populated, but when you save and close and then re-open it changes the date.....anyone have any idea on how I could have this date field remain what was originally input?
--
You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.
To post to this group, send email to live...@googlegroups.com.
To unsubscribe from this group, send email to livecycle+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/livecycle?hl=en.
Part of the problem might be how your date/time field is setup and
getting its values. So, not knowing how you're getting the value,
maybe try the following.
You could use a text field and use the something like the following
FormCalc script to get what you need for date and time (FormCalc is
easier for dealing with dates than JavaScript. You can get the values
for DateFmt() and TimeFmt() in Help):
if ($.rawValue == null)
then
var d = num2date(date(), DateFmt(3))
var t = num2time(time(), TimeFmt(2))
$ = concat(d, Space(1), t)
else ($.rawValue)
endif
Hope that helps!
P.S.
If you're getting tricky with FormCalc you could do the whole date
calculation in one line:
$ = concat(num2date(date(), DateFmt(3)), Space(1), num2time(time(),
TimeFmt(2)))
On Mar 23, 1:00 pm, "Worst, Debbie" <dwo...@GAIC.COM> wrote:
> I did and the time changed each time I opened the form which would lead me to believe that the date will change also.
>
> ________________________________
> From: live...@googlegroups.com [mailto:live...@googlegroups.com] On Behalf Of Duane Nickull
> Sent: Tuesday, March 23, 2010 3:40 PM
> To: Adobe LiveCycle Developers
> Subject: Re: Date field - default to today
>
> You could use a Date/Time field to test.
>
> D
>
> On 3/23/10 12:34 PM, "Worst, Debbie" <dwo...@GAIC.COM> wrote:
>
> Well, I'm going to do an overnight test to see if tomorrow when I open the form that currently has todays date in it if it changes to the current date tomorrow, because when I had it formatted as date/time, the time changed every time I opened the form, so therefore I would assume that the date will change also.
>
> ________________________________
> From: live...@googlegroups.com [mailto:live...@googlegroups.com] On Behalf Of Duane Nickull
> Sent: Tuesday, March 23, 2010 3:15 PM
> To: live...@googlegroups.com
> Subject: Re: Date field - default to today
>
> yes - Jono's script should work fine.
>
> D
> ********
> 22nd Century (my band) -http://22ndcenturyofficial.com/
> Twitter - @duanechaos
> Blog -http://technoracle.blogspot.com
> ********
>
> On 23-Mar-10, at 12:11 PM, Worst, Debbie wrote:
>
> so do I use a datefield object? If so, it still is changing the time so it will change the date then also.
>
> I'm confused??
>
> ________________________________
> From: live...@googlegroups.com [mailto:live...@googlegroups.com] On Behalf Of Duane Nickull
> Sent: Tuesday, March 23, 2010 2:53 PM
> To: Adobe LiveCycle Developers
> Subject: Re: Date field - default to today
>
> That should work fine. Debbie - the problem, is that if you put one script on the initialize event, it will fire every time the event is thrown so each new user will get a new date. I had assumed you had cast the date to a variable. One easy way to do this is using Jono's script and set a hidden field to equal the date the first time a user opens the form. On subsequent times, the date can be read in (using his "if..else) and used to set the date.
>
> A more elegant solution for this would be to use LiveCycle Workspace on ES2. Including forms as part of a long lived business process is LC ES's forte.
>
> Duane
>
> On 3/23/10 11:48 AM, "Jono Moore" <jono.mo...@gmail.com> wrote:
>
> You need to check whether there is a value in the field or not. If no
> value, then do the date routine - if there is a value then leave it
> alone.
>
> //check if field has value and assign date if no value
> if (fieldName.rawValue == null){
> this.rawValue = new Date();}
>
> //assign current value if field has a value already
> else {
> this.rawValue = this.rawValue;
>
> }
>
> Actually on thinking about it the else may not be needed, I've just
> always had it in there for some reason.
>
> On Mar 23, 11:21 am, "Worst, Debbie" <dwo...@GAIC.COM> wrote:
>
> > I have a date field that the user wants to default to "today". The problem I'm having is that on "initialize" is where I would put the code for the date to be populated, but when you save and close and then re-open it changes the date.....anyone have any idea on how I could have this date field remain what was originally input?
>
> > Thanks,
>
> > ********************************************************************** The content of this e-mail message and any attachments are confidential and may be legally privileged, intended solely for the addressee. If you are not the intended recipient, be advised that any use, dissemination, distribution, or copying of this e-mail is strictly prohibited. If you receive this message in error, please notify the sender immediately by reply email and destroy the message and its attachments. **********************************************************************
>
> --
> You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.
> To post to this group, send email to live...@googlegroups.com.
> To unsubscribe from this group, send email to livecycle+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/livecycle?hl=en.
>
> ---
> Adobe LiveCycle Enterprise Architecture - http://www.adobe.com/products/livecycle/
> My TV Show -http://tv.adobe.com/show/duanes-world/
> My Blog -http://technoracle.blogspot.com/
> My Band -http://22ndcenturyofficial.com/
> Twitter -http://twitter.com/duanechaos
>
> ---
> Adobe LiveCycle Enterprise Architecture -http://www.adobe.com/products/livecycle/
> My TV Show -http://tv.adobe.com/show/duanes-world/
> My Blog -http://technoracle.blogspot.com/
> My Band -http://22ndcenturyofficial.com/
> Twitter -http://twitter.com/duanechaos
>
> --
> You received this message because you are subscribed to the Google Groups "Adobe LiveCycle Developers" group.
> To post to this group, send email to live...@googlegroups.com.
> To unsubscribe from this group, send email to livecycle+...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/livecycle?hl=en.