Update fields with PHP session variables
Update fields with PHP session variables

Hello!
I want to create a system to track when a record is created and modified. I have created all of the fields needed and made them read only so they can't be changed, I just can't seem to figure out the rest.
I'm using a ON UPDATE CURRENT_TIMESTAMP
attribute for lastmodified
, however I still need some way to handle the other three options.
I need to pass $_SESSION["username"]
to the field createdby
and the current time to createdat
when a new entry is submitted.
I also need to pass $_SESSION["username"]
to the field modifiedby
whenever a change is made to a field.
Any suggestions on how this can be done easily?
Answers
Is this using Editor? If so, you can use client-side events or server-side events for that.
Colin
@colin Yes it is using editor - I get using events but don't see what events i'd use to call this, especially if a user were to select and edit multiple fields.
Any suggestions on what events specifically would work best for these situations? I figure they would all be client side as all the data needed to handle could be pulled and posted from the client side.
Hi,
The key here is to use the
Field->setValue()
method. It let's you specify a value that will be written to the db for that field - e.g.:Regards,
Allan