Expand my Community achievements bar.

Timestamp Without Signature

Avatar

Level 2

I have created a form using LiveCycle Designer with a button formatted to email me the completed form in PDF format. I would like to have the form timestamped upon submission but without requiring the other individual to sign it. Does anyone know if this is possible and if so, how it would be done?

4 Replies

Avatar

Level 10

Can't you set a field with the current date and time before using JavaScript before your email the form?

The problem with a submit button is that you can't add script to the click even. What you can do

is have a regular button that has some JavaScript to set the field with the date and invoke your email button (ex. btnEmail.execEvent("click")). That way you can hide your email button and make the regular button act like it was the actual email button.

I hope this make sense.

Jasmin

Avatar

Level 2

Thanks, that does make sense. However, I unfortunately do not know enough about javascript to code the setting of the field. I have examined the code for the Date/Time field function, which is setting the time any new activity occurs on the form. However, I need it to simply set the time and not have it change. Perhaps you or someone can give me some direction on this. Here is the code for my email submit button and the code I had for the date/time field.

<field name="Button1" y="222.25mm" x="85.725mm" w="31.75mm" h="12.7mm">
            <ui>
               <button highlight="inverted"/>
            </ui>
            <font typeface="Myriad Pro"/>
            <caption>
               <value>
                  <text>Submit by Email</text>
               </value>
               <para vAlign="middle" hAlign="center"/>
               <font typeface="Myriad Pro"/>
            </caption>
            <border hand="right">
               <?templateDesigner StyleID apbx2?>
               <edge stroke="raised"/>
               <fill>
                  <color value="212,208,200"/>
               </fill>
            </border>
            <bind match="none"/>
            <event activity="click" name="event__click">
               <submit format="pdf" target="mailto:myname@mycompany.com?subject=Code Completed Form " textEncoding="UTF-8"/>
            </event>
         </field>

<field name="DateTimeField3" y="206.375mm" w="62mm" h="9mm" access="readOnly">
            <ui>
               <dateTimeEdit>
                  <border>
                     <?templateDesigner StyleID aped3?>
                     <edge stroke="lowered"/>
                  </border>
                  <margin/>
               </dateTimeEdit>
            </ui>
            <font typeface="Myriad Pro"/>
            <margin topInset="1mm" bottomInset="1mm" leftInset="1mm" rightInset="1mm"/>
            <para vAlign="middle"/>
            <caption reserve="25mm">
               <font typeface="Myriad Pro"/>
               <para vAlign="middle"/>
               <value>
                  <text>Timestamp</text>
               </value>
            </caption>
            <calculate override="error"/>
            <bind match="none"/>
            <event activity="ready" ref="$layout" name="event__layout_ready">
               <script>$.rawValue = Concat(Num2Date(Date(), "YYYY-MM-DD"), " ", Num2Time(Time(), "HH:MM:SS"))</script>
            </event>
            <?templateDesigner floatingFieldPlaceholder {current date/time}?></field>

Avatar

Level 10

How about you put this script on the click event of the button:

if(TextField1.rawValue == null){
    var now = new Date();
    TextField1.rawValue  = now.toDateString() + now.toTimeString();
}


btnEmail.execEvent("click");

Jasmin

Avatar

Level 2

Thanks for pointing me in the right direction on this. What I ended up doing was adding javascript to my existing submit by email button. This is not the submit by email button but just a regular button where I changed the control type to submit. Under the first event tag, I added the following second event:

<

event activity="mouseDown" name="event__mouseDown">

<

script contentType="application/x-javascript">var rightNow = new Date();

form1.subform1.TextField8.rawValue = (rightNow.toDateString()).substring(4,(rightNow.toDateString()).length) + " " + (rightNow.toTimeString()).substring(0,8);

</

script>

</

event>

This filled in the text field I created with the current time from the pc as a static value, creating the timestamp I needed. Thanks again for your help!