How to set time portion of date time control in Nintex Forms 2013

  • 15 July 2015
  • 1 reply
  • 131 views

Userlevel 6
Badge +16

If you need to set the default hour and minute values for some date/time controls on a Nintex form, take a look at this using the JavaScript variable option in the Nintex form settings.

 

98454_pastedImage_0.png

 

 

 

In the form date/time control settings, set the property named "Store Client ID in Javascript variable"

 

In this sample it is named testdate

 

Then you will need to add this javascript to select the Hour Dropdown and Minutes dropdown. Refer to code snippet below:

 

 

NWF$(document).ready(function(){

      var PreTrialHour = 1 + " " + "PM";

      var PreTrialMinute = "30";

      var date = NWF$("#" + testdate);

      var hourddl = date.parent().find("select[id*='DateHours']");

      var minddl = date.parent().find("select[id*='DateMinutes']");

      hourddl.val(PreTrialHour );

      minddl.val(PreTrialMinute);

});

 

In this snippet, we basically give our DatePicker a 'testdate' javascript variable name. Then on document ready, we set both the hours dropdown and minutes dropdown to our desired values.

 

 

 

 

 

 

This document was generated from the following discussion: Setting time portion of date time control


1 reply

Badge +2
In more recent versions of Nintex, use var PreTrialHour = "13"; to populate as 1 PM.

Reply