Display Last Edited Date in Submissions Directory

By default, RSForm!Pro's Submissions Directory menu item can only be configured to display the date and time the submission was made on, not when it was last modified. However, due to the component's extended flexibility, this can be implemented with custom scripting. In this article we will provide a step-by-step guide to achieving such a functionality.


Some modifications will need to be performed for both the form you are adding this for, and its submissions directory (displayed information and a custom script).


The form


We will record the last time a submission was edited in a hidden field:


  • Head to Components >> RSForm!Pro >> Manage Forms >> edit your form >> Components
  • Add a hidden field to the form and edit it
  • In its Default Value area add Never. This value will be later updated by our custom code which will be triggered when a user will modify his submission.

  • Submissions Directory (configuration and code)


    Configuration


    The Submissions Directory will need to be configured in such manner so that the hidden field which holds the last time the submission was edited on will be displayed in the listing, details and in the editing layouts:


    • Head to Components >> RSForm!Pro >> Manage Directories >> edit your form's directory >> Directory Fields and check your hidden field in the Show in Listing, Show in Details and Editable columns
    • Next head to Components >> RSForm!Pro >> Manage Directories >> edit your form's directory >> PHP Scripts and add the following code in the Scripts called when submission is updated section.
    $db = JFactory::getDbo();
    $db->setQuery("UPDATE #__rsform_submission_values SET `FieldValue`='".date('m/d/y H:i:s')."' WHERE `SubmissionId`=".$submission->SubmissionId." AND 
    FieldName='name_of_hidden_field'");
    $db->execute();
    
    NOTE: Make sure to replace name_of_hidden_field with your hidden field's actual name.

    5 persons found this article helpful.


    Was this article helpful?

    Yes No
    Sorry about that

    You Should Also Read

    Set up conditionals for groups of fields HOT

    Fields are not showing up in the frontend HOT

    How to copy information from other fields

    Calculate user's age using BirthDay field