how to enable a disabled date picker on the form

I have a date that is disabled on the the form. I run a javascript method to enable the date. the mehtod is set to run on the form event of 'onFormPopulate'. I can enable the text field portion of the date, but the datepicker(calendar pop-up), will not enable. I cannot get the calendar to allow me to select a date. Is there a way to enable the calendar?

getFieldByName("_actual_plan_bill").getElementsByTagName("input")[0].disabled = false;
Parents
  • Hi Plugg,

    The date field is composed of two input fields, the text field and the image field.  The getFieldByName("_actual_plan_build") function will return an array with two elements.  The code you've shared will enable the text field only, but it's a simple fix to also enable the datepicker field.  Right after that line of code, add:

    getFieldByName("_actual_plan_bill").getElementsByTagName("input")[1].disabled = false;
    You may also need to change the image of the calendar to the non-disabled file, which can be done by adding this line:
    getFieldByName("_actual_plan_bill").getElementsByTagName("input")[1].src = "../images/calendar-disabled.svg";
    Hope this helps,
    Kate
  • Kate,

    Thanks for your response. However, I still can't get the calendar to work. After adding both lines of code, the calendar is now greyed out. could it be i'm using the disabled.svg?

Reply Children
No Data