Tuesday, April 25, 2017

Nintex Forms: Birthday Date Picker Year

Issue: By default the date picker will display the years as ±10 years. This is not suitable for a Date of Birth date picker. 

Fix:


  1. Edit the form in Nintex Forms.
  2. Double click the Date picker field.
  3. Open up the "Advanced" section.
  4. For setting "Store Client ID in JavaScript variable" change to "Yes".
  5. An additional field will be visible called "Client ID JavaScript variable name". Provide it a name. In my example it's called "birthdayControl".
  6. Click Save. Dialog will close.
  7. Click "NINTEX FORMS" on the ribbon.
  8. Click "Settings"
  9. Open up the "Custom JavaScript" section of the "Settings - Form" dialog.
  10. Add the following:
    NWF$(document).ready(function(){
          NWF$('#'+birthdayControl).datepicker('option',{yearRange:'-80:-0'});
    });
  11. Change the variables to suit your situation:
    1. birthdayControl: Client ID Variable set in step 5 above.
    2. -80: How many years back you want to display in the date picker.
    3. -0:How many years forward you want to display in the date picker.
  12. Click "Save". Dialog will close.
  13. Publish the form.
  14. Your specific date control should now show a more appropriate year selection for Date of Birth.