prefill Formstack form field with timestamp?

46 Views Asked by At

Apologies for a newbie question. I'm not a developer.

When the form loads, I'd like to display the epoch timestamp as a number in a read-only field. (I want a unique ID for each submission and cannot use the Submission ID for our needs.)

We have very basic Formstack Forms and there's no option in settings to load JavaScript so I am using the Embed Code field in the form itself. Appreciate someone getting me on the right path.

The field is labeled "ID". When I inspect the form in preview, that field is 159978255.

I was trying this JavaScript built from previous examples on this forum, but the field loads empty.

    <script type="text/javascript">
     //Do something before the form loads
    function FF_OnBeforeRender(){
      var timeStamp = +new Date;
      document.getElementById('159978255').value = timeStamp ;
    };
    </script>

Thanks!!

0

There are 0 best solutions below