I have a visual force page with an apex controller. In the controller I have a variable Date date1. In the page I have an <apex:input type="date" value="{!date1}"/>. Everything works fine.

Now I need to have only a month-year selector, no day has to be showed. One option could be to use instead two number input, or a picklist (for months) and a number (for the year) but I'd like to mantain a calendar standard element.

Is there any way?

| improve this question | | | | |

You would need to use jQuery to achieve that.
The following jsFiddle has a working example. http://jsfiddle.net/bopperben/DBpJe/

This jsFiddle was created by a user on the following post. https://stackoverflow.com/questions/2208480/jquery-ui-datepicker-to-show-month-year-only

| improve this answer | | | | |
  • The next question is, how is it going to be stored in Salesforce? – Nick Cook Aug 26 '15 at 13:32
  • @Nick Cook. I agree. But since the OP mentioned that he is also considering creating 2 separate fields to capture month and year, I would assume the storage part is figured out already. – Aayush K Aug 26 '15 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.