3

Exposed Date of Birth Field on Visualforce page. This is of Date type Its shows Historical dates only, can i have dating back to at least 1900.

  • You're going to need to be more specific about what you're after. Tells us what you've tried and what aspect of it you're specifically stuck on. – Nick Cook Dec 4 '13 at 11:44
3

I have used the code shown in the following post from developer force and it works perfectly. Note though that if you are using it on a VF page, you must have showSidebar=true and showHeader=true for it to work

https://developer.salesforce.com/forums?id=906F00000008kzBIAQ

I have not used this one but it seems to be similar in function

http://setupforce.wordpress.com/2012/10/16/populating-a-historic-year-range-on-the-calendar-pop-up-in-salesforce-crm/

EDIT

Adding the code for the first link at request of @TestNS

1) Go to Setup -> App Setup -> Customize -> User Interface. Here make sure the 'Show Custom Sidebar Components on All Pages' is checked.

2) Go to Setup -> App Setup -> Home Page Layouts. Make sure all your Home Page Layouts have the Messages & Alerts component checked.

3) Go to Setup -> App Setup -> Home Page Components. Here, click edit for Messages & Alerts. In the textarea, copy and paste the javascript code below and save (it can just go below your normal Messages & Alerts, won't show up on the actual page).

<script src="/js/dojo/0.4.1/dojo.js"></script>
<script src="/soap/ajax/11.1/connection.js" type="text/javascript"></script>
<script type="text/javascript">
dojo.require("dojo.collections.Store");
dojo.require("dojo.charting.Chart");
dojo.require('dojo.json');
var arYears = getYears();
function swapYears(){
    // Contact Birth day
    if(document.getElementById('calYearPicker') != null) {
        var select = document.getElementById('calYearPicker');
        var curValue = select.value; 
        var parentx = select.parentNode;
        parentx.removeChild(select);
        select = document.createElement('select');
        select.size = 1;
        select.id = 'calYearPicker';
        select.name = 'calYearPicker';
        parentx.appendChild(select);
    }
    if(select != null) {
        for(x=0;x<100;x++) {        
            select.options[x] = new Option(arYears[x], arYears[x], false, false);
        }
    }
}
function getYears() {
    sforce.sessionId = getCookie('sid');
    sforce.connection.sessionId=sforce.sessionId;
    var out = [];
    // generate dates for the last 100 years
    var currentTime = new Date()
    var year = currentTime.getFullYear()
    try {
        for(x=0;x<100;x++) {
            out[x] = x+year-99;
        }   

    } catch(error) {
        alert(error);       
    }   
    return out;
}
dojo.addOnLoad(swapYears);
</script>
| improve this answer | |
  • Can you please paste the code if possible. As i dont have access to this sites from client location – TestNS Dec 4 '13 at 12:06
  • Just added the code for the first link, hope that helps – Chris Duncombe Dec 4 '13 at 12:12

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.