I'm using the following jQuery to re-enable all controls within a panel, that was initially disabled by a Form Rule:
NWF$('.form2 *').prop('disabled', false);
Everything gets re-enabled as expected, EXCEPT the datetime picker:
The calendar image remains opaque and nothing happens when I click on it, as if no event is associated with it...
PS: the actual input control of the datetime picker is enabled correctly, it's just the picker that doesn't seem to work!
Does anyone know how to force it to be enabled, or at least re-attach the calendar popup event??
Solved! Go to Solution.
the most probably the icon doesn't have property 'disabled' so it's not found by your selector.
you will have to investigate DOM structure to find out what property controls icon's functionality.
why not to write rule's formula so that it disables control only when needed and leave them enabled in other cases?
The rules for enabling/disabling the specific panel were quite complex, that's why I opted to use JS instead of the regular form rules...
It is strange however that ALL other controls have been enabled, but the datetimepicker does not seem to trigger the popup event! Is there no way to re-attach the event handler manually?
Just FYI, here's the DOM structure:
I can easily remove the cursor and opacity styles, the only issue seems to be the event not triggering!
I can only imagine it's being added/removed by the Nintex Form using jQuery UI?
whatever are your reasons resp. however the rule is complex I wouldn't do it that way!
however, if you insist on that following worked for me for single date picker
so, the img/icon recognizes disabled property.
I do not know why it's not accepted with your selector. maybe it evaluates presence of disabled differently (prop need to be removed), but likely it might as well be due to reasons I mentioned above.
Thanks for your suggestions, I really hoped the removeProp command would work!
It does work if I disable the panel manually (which might also be a valid alternate solution btw), but it doesn't work if it has been disabled by the form rule...
For some reason the Nintex form changes the mimeType of the image from GIF File to Gif Image, and probably does something else to affect the event handler as well!
The problem with the missing event handlers only shows up when I manually re-enable a datetime picker that was previously disabled by a form rule...
Anyway, since I couldn't find a solution for locking/unlocking from Form rules + JS, I decided to only do the locking from JS! So whenever I disable the datetime picker by setting its disabled prop to false and then re-enable it, works like it should
I'll mark your original answer as correct, thanks for your time!