Skip to main content
Nintex Community Menu Bar

Set date (end date = start date)

  • Jul 18, 2017 7:18 AM UTC
  • 5 replies
  • 35 views
  • Translate All

Forum|alt.badge.img+10

Hi everybody,

I have a form where the user is asked to give a start and an end date.

After giving the start date, the end date should be prepopulated with the start date, whereas this should still be editable.

Cheers,

mai-kel

‌ ‌

5 replies

Forum|alt.badge.img+9

Hi ‌,

Try this JS code.

NWF$('#'+Date1).change(function()
{
var date=NWF$('#'+Date1).datepicker('getDate');
NWF$('#'+Date2).datepicker('setDate', date);    
});

Thanks,

Lakshmi C‌

Translate

Forum|alt.badge.img+10
  • Author
  • Nintex Partner
  • Jul 18, 2017 12:15 PM UTC

Great. That's it! Thanks a lot buddy! grin.png 

Translate

Forum|alt.badge.img+3
  • Novice
  • Jul 25, 2017 4:34 AM UTC

Hi Lakshmi C 

I'm new in Nintex. Can you please provide the steps to apply this JS code in Nintex form?

I've tried paste the code in Setting - Form > Custom JavaScript Box 

And change the code as below but it doesn't work.

NWF$('#'+VisitStartDateTime).change(function()
{
var date=NWF$('#'+VisitStartDateTime).datepicker('getDate');
NWF$('#'+VisitEndDateTime).datepicker('setDate', date);   
});

Thanks,

Emily

Translate

Forum|alt.badge.img+10
  • Author
  • Nintex Partner
  • Jul 25, 2017 1:43 PM UTC

Step 1:
Create first date / time control.
Go to advanced settings and configure
- "Store Client ID in JavaScript variable" -> yes
- "Client ID JavaScript variable name" -> Date1


Step 2:
Create (second) date / time control.
Go to advanced settings and configure
- "Store Client ID in JavaScript variable" -> yes
- "Client ID JavaScript variable name" -> Date2

Step3:
Go to form settings.
Open "Advanced", insert the following code into "Custom JavaScript Includes":

NWF$('#'+Date1).change(function()
{
var date=NWF$('#'+Date1).datepicker('getDate');
NWF$('#'+Date2).datepicker('setDate', date);    
});

Translate

Forum|alt.badge.img+3
  • Novice
  • Jul 26, 2017 6:34 AM UTC

It worked Michael, thanks.

Translate