Get the date/time of a front end form submission

<%- if @topic_view.topic.tags.present? %>
<%= t 'js.tagging.tags' %>: <%- @topic_view.topic.tags.each do |t| %> <%= t %> <%- end %>
<% end %>


I am trying to add a timestamp to form submissions written to the DB, using pointers from this thread.

Is there a built in method on a form object to get the date/time of the submission?

I am trying to manually set a form hiddenfield’s value in the FormAction, but cannot make it work…

//setting the date at creation works,
// however, I would prefer the timestamp to be when the submit handler fires

//I have tried the following methods in the FormAction, without success
public function submit($data, $form) {


 $form->setField('Date', DBDatetime::now());


 $submission = Contact::create();



You should be able to get the date the dataobject $submission was written from it’s Created property. ie $Submission->Created.

Thanks @MilesSummers!

just wonderung how the sourcecode looks like, do you have an example? cant get it to work.
I also use the sourcecode with some modifications as you posted.