Page 1 of 1
How to Change Field Value When Copying
Posted: Thu Oct 03, 2013 9:44 pm
by skymark
Hi all,
I have a CreateDate field in a table. I have set it to be ew_CurrentDate() for "Add Page". But when I hit "Copy" button, it shows the saved date of the record that is being copied. How to set it to be the current date when copying?
Re: How to Change Field Value When Copying
Posted: Thu Oct 03, 2013 10:22 pm
by mobhar
Simply insert the following code into your "Row_Rendered" server event:
if (CurrentPageID() == "add") {
$this->CreateDate->EditValue = ew_CurrentDate(); // change to the current date
}
Similar to this topic/post: http://www.hkvforums.com/viewtopic.php? ... 693#p93693
Re: How to Change Field Value When Copying
Posted: Thu Oct 03, 2013 11:34 pm
by mpol_ch
hello
When use the recommended code, then I lose the date format. I am using the d.m.Y H:i.
The below code helped me
if (CurrentPageID() == "add") {
$this->Datum->EditValue = date("d.m.Y H:i"); ; // Heutige Datum und Zeit bei Kopieren.
}
mpol_ch
Re: How to Change Field Value When Copying
Posted: Fri Oct 04, 2013 1:59 am
by skymark
It works, thanks both of you.