In “Date Input” control (Date Input - Date/Time Picker), how to restrict calendar pop up from being display past dates or deactivate past dates?
In the validation section - I would imagine formatted date range would work - there is a minimum value that would need to be populated
Thanks for the response.
I tried it. Used formatted date range and specified minimum and maximum values, but that doesn’t disable past dates and use can still select past dates.
weird - thought i responded to this yesterday - forums were down looks like yesterday - maybe loss of data? anyways it sounds like a custom behavior of not showing past dates with a popup window - the validator is most likely meant as a loss of focus or onsubmit of the form for validation to kick in… you might have to open a service request with software ag if it is important
has anyone been able to do this?
This feature is probably one of the most sought after in any portal and there are several free downloadable widgets that provide features to disable dates in a popup calendar based on rules.
Looking at the properties of Formatted Date Range Validator, one would think “Ah!, cool, now I can specify the range of dates that user will have access to in the pop up calendar”. Unfortunately, it does not disable the dates outside the range, but throws a Validation message upon submitting the form. You would say, “Well, so be it, even if it is not proactive, atleast it tells the user that date selected is out of range”.
Now, when you look at the options to choose Min and Max Dates, the option selector is a Calendar asking you to choose a specific Date!!!
The least one would expect from a Date function is that it is configurable for a run time value rather than a design time.
Fortunately, you can specify a value binding expression as well for min and max values if you feel that the date picker does not allow you to provide run time values. I must be very impatient coz I tried all ( or so I think ) java date format and parsing functions, but the Validator simply refuses to accept anything.
- Should the value be a Date type or a String type?
What format should it be in?
Should we specify a format or does it take the default format?
Also, I noticed that the validator behaves in a way that you have to necessarily specify the Max Date as well if you choose a Min Date (using the Date picker), else it complains.
Apologies, if I seem to be too whining, but the client simply expects that CAF provides you all the tools to minimize any coding and this is an easy feature that can be done in minutes if not in seconds.
Hopefully someone who has done this can show us that we are walking in the wrong path.
There is definitely a bug in the Formatted Date Range Validator. It will be fixed in the next release. If you need a fix prior to 8.2, please file a Service Request referencing this thread and the internal defect ID: WMC-1561
I’m going to revise my last statement. After going back and getting some feedback from the team’s expert, I have the following information (I learned something new about Validators and Converters). I had provided a sample test app, which was reviewed and fixed. (Thanks Eric!)
Please see the attached ‘fixed’ test app for an example of how to Formatted Date Range Validation.
ValidatorTestApp_fixed.zip (15.4 KB)
If I am understanding this correctly, this behavior is not recognized as a bug but as a normal feature.
If so, this puts us back at the original problem:
Is there a way to disable (runtime evaluated) values on date input control?
Now I’m getting lost
You have the ability to validate against dynamic date ranges, but that’s not what you want, correct?
Instead, you want to limit what is presented by the date range picker? No, that isn’t a supported feature.
Thank you for your answer. I’m sorry, maybe I was’nt clear.
My point is that :
2- It also seems not possible to even perform a validation of the user input that is based on values determined after rendering - for instance dependent on the value set by the user on another portlet control.
To make it more objective, my real problem now is that I want to accept a date range using 2 date input controls and I want the startDate control to validate date previous to the endDate control and vice versa.
[mark] Not quite correct. Once the user sets the value on the other control, you can refresh the date picker and use the technique demonstrated in the previous attachment to refresh the date picker and apply your date-specific validation.
I tried to follow your suggestion with no success. I modified your demo to accept a values for the “yesterday” limit but it keeps validating against the original value.
It seems that the Validator binding isn’t getting the updated values.
Could you help finding out my mistake? (modified project in attach.)
ValidatorTestApp.zip (16.1 KB)
I stand corrected (again). My suggestion doesn’t work as you’ve already found out. Currently, there isn’t a way to dynamically update the standard JSF validation controls. I think you’ll have to use custom Validators which invoke your custom java code where you can code this directly.