onAfterProcess does not update

updateFormData is updating the form data.
onAfterProcess is running "end of form submission" and "after data stored", so the form data won't be accessed at all.
onAfter Process you must update directly into the database.
 
Ok, I use the suggestion on that post:
PHP:
$rowid = $formModel->getRowId();
if (!empty($rowid)) {
   $db = JFactory::getDBO();
   $newNumber = "ECR-" . $rowid;
   $query = $db->getQuery(true);
   $query->update('eng_eco_request')->set("number = '$newNumber'")->where("id = $rowid");
   $db->setQuery($query);
   $db->query();
}

and obviously changed the table and field name.

I also test it removing the "where" condition but nothing change non my field. :(:(:(
 
I found that the update fails because $rowid is always empty. I test with this 2 method:
$rowid=$formModel->getRowId();
or
$rowid=$formModel->_formData[id];
 
Back
Top