Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Lock current date after save

Avatar

Level 2

In the form I am working on I have a current date field.  When the user saves the form I would like that date to be locked so when the form gets emailed to me and I open it, I can see whent the user sent it.

Is this possible?  Any help would be great.

3 Replies

Avatar

Level 3
Level 3

Hi,

write the below code on preSave event of date field:-

if(this.value!=null)

{

          this.access="readOnly";

}

Thanks

Avatar

Level 2

Still having a problem....not working.  Next time I open the form (I've forced a date change on my pc) and it changes to the current date.  Is this correct?

form1.#subform[0].CurrentDate::preSave - (JavaScript, both)

if(this.value!=null)

{

          this.access="readOnly";

}

Avatar

Level 3
Level 3

Hi,

I am sorry i have provided solution according to date field, but you are using current date field.

So you can try below code:

There is a code written on the layout ready event.After change code at layount event will be like ::

if(form1.#subform[0].CurrentDate.value!=null)

{

     $.rawValue = num2date(date(), DateFmt(1))

}

Thanks