How to Change Field Value When Copying

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
skymark
User
Posts: 183

How to Change Field Value When Copying

Post 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?


mobhar
User
Posts: 11768

Post 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


mpol_ch
User
Posts: 877
Location: Switzerland

Post 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


skymark
User
Posts: 183

Post by skymark »

It works, thanks both of you.


Post Reply