How to insert validation in datepicker interactive report in apex5.0 - oracle-apex-5

I have one field :P2_DATE, datepicker on an interactive report in apex5.0.
First Question:
How can i create validation thru:
1. A dynamic action
2. A validation process
that gives an error msg: 'Date should not be greater than system date'
when user choose from datepicker.
Second Question:
How to show only today's date in the date picker and disable others dates.
Pls provide steps-by-steps instruction if possible...thxs!!

Add Validation
Set type to PL/SQL Expression and put:
to_date(:P2_DATE,'DD-MM-YYYY') = to_date(sysdate,'DD-MM-YYYY')
You can see this Answer:jQuery Date Picker - disable past dates for disable dates in datepicker but you already have control over date by validation.
Another way is to create custom datepicker from external plugin.

Related

vaadin flow DateTimePicker returns null if only one field entered

I'm using a DateTimePicker with vaadin flow 23.0.5.
The problem is that if a user only enters either the date or time (but not both), then when I save the field using a binder the result is a null LocalDateTime.
import com.vaadin.flow.component.datetimepicker.DateTimePicker;
private DateTimePicker noticeTwoDateTime;
noticeTwoDateTime = new DateTimePicker(label);
layout.add(field);
binder.forField(this.noticeTwoDateTime).bind(
NoticeTemplate::getNoticeDateTwo,
NoticeTemplate::setNoticeDateTwo);
Is there some way to warn the user that they must enter both?
I've explored using a validator but it only gets passed the LocalDateTime which of course is null.
First of all you can use a helper text as described here:
https://vaadin.com/docs/latest/ds/components/date-time-picker/#providing-input-guidance
And if that's not enough you can try to create your own validation routine and use it within the binder as e.g. here:
https://vaadin.com/docs/latest/flow/binding-data/components-binder-validation/#defining-validators
Could look similar to this then:
myDateTimeBinding = binder.forField(myDateTimePicker)
.withValidator(myDateTime -> Validation.validateDateTime(atdDateTimePicker.getValue()),
"Please pick Date and Time")
.bind(......
with Validation as your Validation Utils Class and validateDateTime as your method returning a boolean.
Workaround: If you mark the field as being required/mandatory then the DateTimePicker shows an error message, if one of both is missing.
Yeah sure, you don't want mark every date/time as required....
This problem seems to have existed already in Vaadin 14: Vaadin 14 DateTimePicker with optional time or warning for missing time

Selenium Google Trends Custom period

I am trying to get daily data from Google trends using Selenium.
Therefore, I need to Input the start and end date in both boxes. For the start date, I use the following which works fine:
elem4 = browser.find_element_by_class_name("md-datepicker-input")
elem4.clear()
elem4.send_keys("01/01/2018")
However, the second box has the same class name 'md-datepicker-input'.
Picking it via xpath also doesnt work...
Has anyone an idea how to select that box, clear it and input my data?
Example custom period
Here is the CSS that you should use for To date.
.custom-date-picker-dialog-range-to .md-datepicker-inpt
If you want to use xpath
//div[#class='custom-date-picker-dialog-range-to']//input[#class='md-datepicker-input']

Bootstrap 3 - DateTimePicker - Can time portion be ignored?

I'm using the Bootstrap 3 DateTimePicker. When the user tabs into a field using this component, the current date and time is automatically entered. In some cases this is what I want. However, there are other times I want the component to completely ignore the time portion and not entered by default in a field. I can't seem to find a way to do this.
This will only display the date by default, try and see
$('.future');.datetimepicker({
pickTime: false,
format: 'DD/MM/YYYY'
});

Passing a previous date in link

I want to create a link name as Previous date and Next date in my show action. Please suggest me that how should I pass the date in that . i.e. If one clicks on the previous link then the records are displayed of the previous day and vice versa.
How to pass the date in show action? Please guide.
P.S. :- I am using rails 3
To display date and pass as link parameter you can use either ruby code or jQuery .
Ruby : To get the date :
How to calculate next, previous business day in Rails?
Put such function in your application helper . And call into you view and also pass as link parameter .
jQuery :
Error creating a '< previous' and 'next >' (date) link for jQueryUI datepicker using setdate

Dojo popup date picker

how do i make up the popup datepicker in dojo which should have seperate dropdown box for year,month..?
I dont think there is a date picker with separate year and month drop downs... I use dojo DateTextBox. The implementation is simple...
require(‘dijit.form.DateTextBox’);
<input type=”text” dojoType=”dijit.form.DateTextBox” name=”date” id=”date”/>
And why would you want separate year and month selectors when its easier for the user to select date from a calendar??? You can take out any part of the date on server side as you please once it is posted....
#Black Rider - it's better if you disable the ability for users to type in a date field. This way, you don't have to worry about validation if they just can select a date from the date picker.
I've had applications where users would need to select a date from many years in the past, e.g. 2002 or even the late nineties. What if you have an app where someone has to enter their birthday?
You could use a jQuery date picker instead, where you can easily add the year.
What Black Rider said is true (and DateTextBox is a great widget), HOWEVER there are also "mobile" dojo widgets that have what you are looking for:
1) "ValuePickerDatePicker" - http://dojotoolkit.org/reference-guide/1.9/dojox/mobile/ValuePickerDatePicker.html#dojox-mobile-valuepickerdatepicker
2) "SpinWheelDatePicker" (very iPhone-y) - http://dojotoolkit.org/reference-guide/1.9/dojox/mobile/SpinWheelDatePicker.html#dojox-mobile-spinwheeldatepicker