Re-enable a disabled Date\Time field in SBM

I have to add some form actions to disable and re-enable a Date\Time field, so when I re-enable a disabled Date\Time field and I find that the calendar picker is not functioning correctly, it's likely due to the JavaScript associated with the date picker not being properly reinitialized after the field is enabled again. It sounds like some of the event handlers or bindings to the calendar picker get lost or don't reattach properly when the field transitions from disabled to enabled.

Any suggestion on re-enabling a Date\Time field without losing calendar picker functionality?


Thanks!

Parents Reply Children
  • 0 in reply to   

    Thank you, that line didn't work for me. I did a workaround using javascript to hide/show the date-Icon:

    To hide it:

    var dateIcon = document.getElementById(GetFieldByName("DateTime Field Name").id+'cal');
    dateIcon.style.display = 'none';

    and to show it again in another form action I wrote this:

    var dateIcon = document.getElementById(GetFieldByName("DateTime Field Name").id+'cal');
    dateIcon.style.display = 'inline';


    and to prevent the user from changing the value manually I made the field read-only instead of disabling it as the whole issue is with disabling the field, using this code:

    const DateFieldInput = document.getElementById(GetFieldByName("DateTime Field Name").id);
    DateFieldInput .setAttribute('readonly', true);

    and it is working fine with me.