SaintGobain
Scholar

Calendar control - only month and year

Hello,

 

I need to choose only the month and year on the form. Is there a change so that only the month and year can be selected in the calendar control? I saw that I can change the format, but the choice shows with the day.

Labels: (1)
0 Kudos
Reply
3 Replies
ernie_hayter
Apprentice

Re: Calendar control - only month and year

Hi @SaintGobain,

 

The calendar control will currently always show the day, irrespective of the format you display it in, with the added caveat that the resultant date that will be saved from the calendar will always include the day as well, which I'm guessing you don't want.

 

Honestly, if you only want the user to select a month and year, I would have a dropdown with 1-12 (or Jan to Dec, depending on what format you want) and a textbox that is defaulted to the current year and use some JS to change the textbox's type to number (you can substitute the name of your text box and you can get the current year using an expression, or drop the max if you want to allow dates in future): 

<script>$("[name='Year Text Box']").attr("type", "number"); $("[name='Year Text Box']").attr("max", "2022");</script>

 

Put the above JS as the Text value in a Data Label with Literal = true, Prevent XSS = false, the DL must be added to the canvas after the textbox. It will add a "spinner control" to the textbox that can be used to decrease/increase the year for easy entry. If you don't want to use any JS, I suggest you use a dropdown with hard-coded years.

 

HTH,

Ernie

Reply
DavidL2
Nintex Professional Services Expert

Re: Calendar control - only month and year

You can set the control to only select a date, but there is not a setting for only month/year.  You could still use the calendar control, then use use the Month and Year functions to pull out those values.

 

 

0 Kudos
Reply
SaintGobain
Scholar

Re: Calendar control - only month and year

Hi,
thanks for the exact solutions. I chose the option with the drop down list.

Thanks for your help

0 Kudos
Reply