Skip to main content
Known Participant
September 26, 2017
Pregunta

How do I display the leading zeros in a field for a month and limit the value to 01-12

  • September 26, 2017
  • 2 respuestas
  • 2873 visualizaciones

Our users want a form that has separate fields for month, day and year. Please let me know how to validate the fields so that they are numeric only and limited to valid numbers for the mm and dd fields.

Thanks for the help!!

Ken K.

Este tema ha sido cerrado para respuestas.

2 respuestas

JR Boulay
Community Expert
Community Expert
September 26, 2017

Just use the built in Date format, available in field Properties : Format.

Acrobate du PDF, InDesigner et Photoshopographe
Inspiring
September 26, 2017

This might not be the best approach since one could still enter an invalid date since the number of days in a month is dependent upon the month and year field values. For example the is no June 31 in any year and February 29 on occurs in non-century years evenly divisible by 4 and century years divisible by 400. One can use the "Format" tab, the "Special" format category, using the "Custom" mask to limit the input and displayed values for the date and month to values between 00 and 99 and the year between 0000 and 9999. If you want to limit the month between 01 and 12 and the days between 01 and 31 then you need use the RegExp object to control the "Custom Keystroke script" and you will still need to provide some additional validation to verify that the entered combination of the month, day, and year is a valid date using the util.scand() method.