@AHHP I’ve done that, I don’t understand a lot of it. Basically, if I have a table in the database, which would be the appropriate event to use to add the contents of 3 custom fields and the content field?
Following the examples provided in jot.events.php, specifically the onFirstRun and onSaveComment events, I thought that I could basically copy them to accomplish saving the custom fields to a table of my choice and then sending a confirmation email to the address provided.
Following the example for onSaveComment() almost to the letter, I wrote something like this:
function onSaveComment($id, $object)
{
global $modx;
$insert = array(
"firstName" => $object->cfields['firstName']
"lastName" => $object->cfields['lastName']
"email" => $object->cfields['email']
"content" => $object->fields['content']
);
// Run the db insert query
$modx->db->insert($insert, 'modx_example' );
}
Which did exactly nothing.
I rewrote it as:
global $modx;
// Init our array
$dbTable = array();
$dbTable[firstName] = $object->cfields[firstName];
$dbTable[lastName] = $object->cfields[lastName];
$dbTable[email] = $object->cfields[email];
$dbTable[content] = $object->fields[content];
// Run the db insert query
$modx->db->insert($dbTable, 'modx_example' );
And tried again but nothing happened with that particular action. However when I put the same code in a number of other locations, a row was created in the table but each field was empty.
I’d appreciate any guidance or explanation you can provide.