You are viewing limited content. For full access, please sign in.

Question

Question

Submission Time - Trying to Get a Submittal Date Applied to my Form

asked on April 19, 2017

When users create forms, they have the opportunity to save as draft and work on it a day or two later. The Date field was populated with the current date. I saved as draft on one day and opened it the next day to finish it. It kept the previous day's date. Not good.

Round 2 - I changed the default value to {/dataset/_submission_time} and a date format of MM/dd/yyy:

I full expected my date to be populated upon submittal. The next step is to save to Laserfiche. This is failing because the date is NOT being populated upon submittal. It is a required field in Laserfiche, hence, the failure. My "thank you" message date is also blank:

What am I doing wrong?

0 0

Answer

SELECTED ANSWER
replied on April 20, 2017

Based on your screenshot, it seems you are using Forms 9. With Forms 10, we added a feature for date field when use today as default value and set the date field to be read-only, then the date value will be populated when submit the form.

With Forms 9, you can use the JavaScript solution provided by Raul.

1 0

Replies

replied on April 19, 2017 Show version history

If you try the code below in the Javascripts section it will refresh the draft form to the present date. Replace the "yourdatebox" portion with your date box's class name.

I believe there is also a built-in function like just adding the word "Today" in the "Default Value" section, but I haven't tried that.

$( document ).ready(function() {
 

var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!
var yyyy = today.getFullYear();
  
var present = mm+'/'+dd+'/'+yyyy;

  $(".yourdatebox input).val(present);

});

 

1 0
replied on April 24, 2017

Thank you! We are upgrading mid-May. I look forward to all the added enhancements, small as they may be!

0 0
replied on October 20, 2017

What about the time of submission.  I need a date and time.  I tried a field with {/dataset/_initiated_time} and it is still blank.  A date field with "today" only captures date and their is no format to include the time.  

0 0
replied on October 20, 2017 Show version history

Add a "Time" field into the form. You can make it readonly or hide it if you don't need to see it. Then just past the value in the form with a Default value of "current_time"

 

 

TimeField.PNG
currentTime.PNG
TimeForm.PNG
TimeField.PNG (4.68 KB)
TimeForm.PNG (1.85 KB)
0 0
replied on October 20, 2017 Show version history

Thank you...i'm not seeing a time field.  Must need an update.

Laserfiche Forms Version 10.1.0.642

0 0
replied on October 20, 2017

Then try using JavaScripts.

Add a field with:

LABEL: time

VARIABLE: time

CLASS: time

and then in the JavaScript section

$( document ).ready(function() {

var dt = new Date();
var time = dt.getHours() + ":" + dt.getMinutes() + ":" + dt.getSeconds();
  
  $('.time input').val(time);

});

 

1 0
replied on October 20, 2017

Worked great thanks!

0 0
replied on June 19, 2018

Im trying to do something similar, I want a text box populated but I want the time that it was submitted.  I have a similar bit of javascript code but that is the time which the form was loaded.  Sadly the specific users may start it and then walk away an potentially come back a half hour later so I need the time the actually hit the submit button.  Is there anyway to do this?

 

The only thing I  could imagine this is to run a workflow to populate that field after it was submitted.

0 0
replied on June 19, 2018

We currently capture this information (plus UTC to keep us on the up and up with auditors). Here's an example for when the Engineering Manager clicked the approve button (emDateSigned). Hope this helps.

$(document).ready(function(){

//capture timestamp
  $('.Approve').click(timestamp);

  function timestamp() {
    
    var d = new Date();
    
    var minutes = d.getMinutes();
    var hours = d.getHours();
        
    var fullYear = d.getFullYear();
    var day = d.getDate();  //returns day as 1-31
    var month = d.getMonth() + 1;  //getMonth returns month as 0-11
    var fullDate = month + "/" + day + "/" + fullYear;
    
    var tz = new Date().getTimezoneOffset();
    var tzDiff = (tz/60);
    var utc = "(UTC-";
    if (tzDiff !== 0) {
      if (tzDiff.length = 1) {
        tzDiff = '0' + tzDiff;
        tzDiff += ':00';
      }
  	  utc += tzDiff > 0 ? '+' : '';
  	  utc += tzDiff + ")";
    }    
    
    if (minutes < 10) {var minutes = "0" + minutes;}
        
    if (d.getHours() < 12) {var a = "AM";}
	else if (d.getHours() == 12) {var a = "PM";}
	else {var a = "PM"; hours = hours - 12;}

    if ($(this).hasClass('Approve')) {
       $('.emDateSigned input').attr("readonly", false);
       $('.emDateSigned input').val(fullDate + " " + hours + ":" + minutes + " " + a + " " + utc)
       $('.emDateSigned input').attr("readonly", true);
    }
  };

});  //close document.ready

 

1 0
replied on June 19, 2018

That is perfect, I just had to switch out the .Approve with .Submit for the form being submitted and change the .emDateSigned to my ID which was #q78 and it worked perfectly populating the textbox after hitting submit.

 

Thank you Gloria St. Denis!!

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.