362
Views
11
Comments
Clear Outsystems Date Picker

Hi, 


Is there a way to clear the date from the Date picker widget once a date has been selected?

I am avoiding writing code to clear the date if the widget does have that option ?

Backspace does not work neither does the Delete button button on the keyboard work 

2021-11-12 04-59-31
Manikandan Sambasivam
AI Generated

In OutSystems, the Date Picker widget doesn't natively include an option to clear the selected date using the Backspace or Delete keys. However, you can achieve this functionality by adding a clear button next to the Date Picker that clears the selected date. 

Steps to Add a Clear Button to the Date Picker:

  1. Add a Date Picker and a Button:

    • Place a Date Picker widget on your screen.
    • Add a Button widget next to the Date Picker to serve as the clear button.
  2. Set Up the Button to Clear the Date:

    • Create a new Client Action that will set the Date Picker's value to NullDate().
    • Assign this Client Action to the OnClick event of the clear button.

Example Implementation:

  1. Add a Date Picker:

    • In your screen, add a Date Picker widget and bind it to a variable (e.g., SelectedDate).
  2. Add a Clear Button:

    • Place a Button widget next to the Date Picker.
    • Set the button's label to something like "Clear" or an icon (e.g., a "cross" icon).
  3. Create a Client Action:

    • Create a new Client Action named ClearDate.
    • Inside this action, set the SelectedDate variable to NullDate().
  4. Assign the Client Action to the Button:

    • In the clear button's properties, set the OnClick event to the ClearDate Client Action.
This answer was AI-generated. Please read it carefully and use the forums for clarifications
2022-10-18 07-32-49
Randall Jodache Chetty

Yeah , this is my last resort 

2023-08-18 10-40-36
Deepak M

Hi Randall Jodache Chetty,

If you are used to setting the variable value to NullDate(), there is a chance to show the NullDate() value in your date picker, like you were selected as "01-01-1900".

To avoid this issue, you can simply call the client action, which is called "DatePickerClear" provided by outsystems. It will reset the selected dates (if any) and clear the input of a DatePicker with a given identifier.

2022-10-18 07-32-49
Randall Jodache Chetty

Thanks , I will check the clear date picker action out but I definitely do not want "01-01-1900 " to show , I rather want it empty 

2023-08-18 10-40-36
Deepak M

Then you should go with the "DatePickerClear" action to make it empty

2022-10-18 07-32-49
Randall Jodache Chetty

I'm avoiding writing code - but looks like I have to now 

2023-08-18 10-40-36
Deepak M

Date Picker clear is an inbuilt client action which is provided by outsystems,

Let me know if this issue is fixed

2022-10-18 07-32-49
Randall Jodache Chetty


Lets hope Outsystems implements this soon

UserImage.jpg
Magnus

An alternative, which was sufficient for me that the content of the field can be deleted with Remove or Backspace, is to use the action “DatePickerSetEditableInput” in the DatePickerInitialized handler.

2024-10-24 09-51-13
Rodrigo Sokolosk Lima

1- Add "DatePickerSetEditableInput " from OutsystemsUI.

2- Create a screen action with  a DatepickerId Input parameter, inside this action add the DatePickerSetEditableInput action and set input to datepickerId.

3- In the initialized event of the DatePicker widget, set the handler your screen action and set the input parameter to DatepickerId.

 

2025-02-26 13-33-59
Matheus jesus

Hello gentlemen,

The solution to this problem is to simply use a Client Action "DatePickerClear" that the 'OutSystemsUI' dependency provides.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.