Event Handler for Accept Button in WinRT Date Picker - datepicker

I am looking for a way to perform some actions when the user taps the accept/checkmark button in the DatePicker control also when the user does not change the date, i.e. this should be different from canceling out of the DatePicker by tapping the back or cancel button. Is there a way to add an event handler to this button?
Background: to help the user selecting a recent date (and avoid excessive scrolling), the DatePicker is set to today's date. The user should be able to
select another date and tap the accept button -> date is saved (this I can handle in the DateChanged event) -> OK (sort of)
cancel by tapping the back or cancel button -> assumed the user does not want to set a date, and no action to save (no event handler needed) -> OK
select the suggested date (today) by tapping the accept button -> date is supposed to be saved but DateChanged does not fire and there is no event for the accept button tapped.
Given the initial answer below I should perhaps emphasize that this is not about getting the date value from the control but about knowing if the user has tapped the accept/checkmark button or canceled the selection. What I'm looking for is a way to customize the DatePicker control so that allows me to capture that event.

This is normal behavior, the DateChanged event is fired only when the date actually change.
Of course you still have a way to have the selected date. Give a name to your DatePicker element:
<DatePicker Name="DatePick" Height="47" Width="323"/>
Then you can get the date by looking at the Date property:
DateTimeOffset selectedDate = DatePick.Date;
Those 2 buttons (done / cancel) are just there to validate the changes made in this UI:
Done : change the value of the Date in the DatePicker element, if the date was changed the DateChanged event is fired, if not then nothing happen.
Cancel (or backbutton) : cancel the date selection, the Date property of the DatePicker element stay the same even if you changed the selected date in the DatePicker.
If you want to know if the user accepted the date you show him, don't use the buttons in the DatePicker UI but add two buttons on your own page, the buttons in the DatePicker UI are just to validate or cancel a change you made to the date.

Related

Material UI DatePicker Differentiate Events

I need to differentiate between the section of a date and the browsing months event.
Right now, both fire onChange event for native Date Picker.
I tried inspecting the object but both events fire objects that look similar.
Material UI Date Picker
How to differentiate between two events?
THanks.

Is there a way to add a "Go to today" to a JavaFX DatePicker?

The title says it all: I have a JavaFX DatePicker and am looking for a way to add a button which, upon a click to it, goes to the current date or at least the current month.
Is there a way to do this?
BTW, I'd like to have this button inside the DatePicker, maybe above the month calendar.
Do I have to modify the skin?
I believe this would work for you
datePicker.setValue(LocalDate.now());
Inside the button action function you can add this code to set the datepicker to the local date

Get value from session and display in an item (date picker) in Oracle APEX

Refer to Figure 1, after user selected Start Date and End Date, then click on the Search button. When the Search button is clicked, the action submit page will be performed. But after the page is refresh, the value in the date picker is empty and the value is stored in the session.
My questions are:
How to get a value from session and display on an item
How to keep the value of dates in date pickers.
By default, value in the item have to be saved after submit. If your item loses its value after button click, then you have made something to that. There is a number of ways to do it, sometimes not obvious, so first check:
Item's properties, Source tab
Processes on the page - it could be a process with type Clear Session State
After that, try to remember all what you did after creating items. Create new page from scratch, add desired items and button with default properties, then make changes in properties one by one and check every change.
In the branch for that submit action, make sure you have entered "set items". Set the item "P20_START_DATE" with the value "&P20_START_DATE'".
In Apex 5, go to the branch, click on "Target" in the behaviour session and set the values there.
Summary, the way to maintain a value in an item after page submit is
Click on the item
Navigate to Source tab
Set Type to item
Set the Item to the Item you want to keep the value

Liferay Autofield with DatePicker

I have a aui form with Liferay.Autofields enabled.
The fields that I am duplicating with Autofield has a button and a textfield. The button click will trigger the datepicker and the selected value should be stored in the textfield.
And, when I click the "PLUS" button provided by Autofield, the fields are duplicated.
First, I need to know how I can bind the trigger event of all buttons to the datepicker. I know to do this for a single button. But since we are using autofield, I need to give the ID of the button with the index. Can anyone suggest how to bind the trigger event in my scenario
Second, once I click the date picker button, I should be able to get index of the Autofield row in which I have clicked, so that I can update my textfield

Can I block a button?

I have a DatePicker() and button in a ControlView, when I click on the button it jump to a function where i work with the date i choose in the DatePicker(which spins), the problem is while is datePicker spining and i click the button it doesn't choose the date and it jump to function without choosing the date. Is posibble while is spining the datepicker to block the button?Or it can be another way?
Thanks for answers
The UIDatePicker control will send an action method when the user has finished rotating the control (for the event UIControlEventValueChanged). You could use this action method to enable the button so that the button can only be pressed after the user has completed picking a date.
See docs:
When properly configured, a UIDatePicker object sends an action
message when a user finishes rotating one of the wheels to change the
date or time; the associated control event is
UIControlEventValueChanged.