Hi everyone,
I’m currently working on a UiPath Form where I use a Date/Time component and a Button. The Date/Time field is usually pre-filled with a date, but I want to allow users to clear this field by clicking a button. Here’s what I’ve tried so far:
-
Component Setup:
- The Date/Time component has the key
frist
. - The Button has the key
fristEntfernen
and is set to trigger aClick
action.
- The Date/Time component has the key
-
Custom Code:
In the Custom Code section, I added the following JavaScript to clear the Date/Time field when the button is clicked:form.getComponent('fristEntfernen').on('click', function() { form.getComponent('frist').setValue(null); });
However, when I click the button, nothing happens, and the Date/Time field remains unchanged.
-
Other Observations:
- I have another JavaScript block elsewhere in my form that correctly formats a date and returns it as part of a string. This part works fine.
- I’ve checked the keys for both components, and they seem to be correct.
Question:
How can I make sure that the Date/Time component gets cleared when the button is clicked? Is there something I’m missing in the configuration or the JavaScript logic?
Thanks in advance for any help!