I have a need to know if a multipage webform submission has been edited, and when, by the current user. If I load the webform submission I can see when it was completed, updated or started, but I don't see how to know if there is an edit in process. This might happen when a person edits a page or 2 and leaves without getting all the way to the end and submitting the submission again.

    $completed = $submission->isCompleted();
    $changed_time = $submission->getChangedTime();
    $completed_time = $submission->getCompletedTime();
    $updated_time = $submission->getData()['timestamp'];

$completed shows if form was ever submitted. $changed_time shows the last time the form action buttons were used, but after the first submit it only updates if the form is submitted again. $completed_time shows the first time the form was submitted. $updated_time shows the value in a field I added where I save the timestamp on the validation of any action button, but this is only available in the submission entity after a submit.

How can I get a real last edit time? Thanks.

  • If the submission hasn't been saved you won't know. But you could check out under Settings > Emails/Handlers of a webform you can configure an email getting triggered when a submission has been updated. Find out how Webform gets that information by looking into the Webform modules code. – leymannx Jun 11 '20 at 5:58
  • The updated trigger seems to fire the same as the $changed_time above -- only when the form is submitted on the last page. Updated means resubmitted since the first submit. I need the intermediate page advances. I'm thinking about putting this in user data. – awolfey Jun 11 '20 at 14:55
  • This, or is it maybe possible to add another submit handler to the "Next" button to let it store the current timestamp into a hidden webform field? But this means saving the whole submission. Which probably updates the updated timestamp anyways. – leymannx Jun 11 '20 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.