How can I validate that start date occors on or before end date?

I am using jDev 11.1.1.6.0
I have a effectiveStartDate and and an effectiveEndDate and I want to validate that if both dates are specified, that the effectiveEndDate occurs on or after the effectiveStartDate.
I have added validators in my backing bean as shown below, but there is still a problem
Consider the following scenario:
1) set effectiveStartDate to 1/1/2011
2) set effectiveEndDate to 1/1/2010
I get the validation, as expected. Now
3) I change effectiveStartDate to 1/1/2010, but the validation message remains on effectiveEndDate because I did not update the effectiveEndDate.
Can I remove the faces message somehow?
Can I re-trigger the validation?
My .jsff page contains
<af:inputDate label="#{ZspBusinessRulesAttrBundle['ColAttr.StartDate.RuleFolderEffectiveStartDate.RuleFolderEO.EffectiveStartDate']}"
id="id1"
value="#{pageFlowScope.manageRuleFolder.effectiveStartDate}"
autoSubmit="true" required="false"
validator="#{pageFlowScope.manageRuleFolder.startDateValidator}"
partialTriggers="id2">
<af:convertDateTime pattern="#{applCorePrefs.dateFormatPattern}"/>
</af:inputDate>
<af:spacer width="10" height="10" id="s4"/>
<af:inputDate label="#{ZspBusinessRulesAttrBundle['ColAttr.EndDate.RuleFolderEffectiveEndDate.RuleFolderEO.EffectiveEndDate']}"
id="id2"
value="#{pageFlowScope.manageRuleFolder.effectiveEndDate}"
autoSubmit="true" required="false"
validator="#{pageFlowScope.manageRuleFolder.endDateValidator}"
partialTriggers="id1">
<af:convertDateTime pattern="#{applCorePrefs.dateFormatPattern}"/>
</af:inputDate>
My backing bean contains
public void startDateValidator(FacesContext facesContext,
UIComponent uIComponent, Object object) {
Date startDate = (Date)object;
if (!Utility.validateStartDateAndEndDate(startDate,
effectiveEndDate)) {
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
Resource.getValidationEndDate(),
null));
public void endDateValidator(FacesContext facesContext,
UIComponent uIComponent, Object object) {
Date endDate = (Date)object;
if (!Utility.validateStartDateAndEndDate(effectiveStartDate,
endDate)) {
throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,
Resource.getValidationEndDate(),
null));
}

Although not ideal, I have worked around the problem. I'd prefer an approach that would retain the error messages on the component, but here is the best I could come up with. I changed the start and end date validators so that they do not throw a ValidatorException but rather add a faces error message that is not tied to any component. This causes the validation message to appear as a popup when changing the start or end date in such a way as to violate the constraint. Unfortunately, the message disappears when you click the ok button.
The changes in the backing bean are as follows:
public void startDateValidator(FacesContext facesContext,
UIComponent uIComponent, Object object) {
Date startDate = (Date)object;
if (!Utility.validateStartDateAndEndDate(startDate,
effectiveEndDate)) {
AdfUtility.addFacesErrorMessage(facesContext, Resource.getValidationEndDate(),
null);
public void endDateValidator(FacesContext facesContext,
UIComponent uIComponent, Object object) {
Date endDate = (Date)object;
if (!Utility.validateStartDateAndEndDate(effectiveStartDate,
endDate)) {
AdfUtility.addFacesErrorMessage(facesContext, Resource.getValidationEndDate(),
null);
}

Similar Messages

  • Org Management - How can I change the start date of all the org units

    How can I change the start date of all the org unit objects and its relationships at one shot ?  I have created some 100 Org units with the wrong start date. Please suggest.
    Thanks in advance..
    Cheers
    Vijay

    Hello Archana,
    Thanks a lot... This has solved my issue...
    Cheers
    Vijay

  • How can i validate(compare) two date type attribute in EO.

    Hi All,
    jdev version 11.1.2.1.0
    i have created one EO where two date type attribute ToDate and FromDate now i want to add validation rule.
    which validate that difference b/w ToDate and FromDate not more than 3 month.
    How can i validate this?

    You can create script expression
    Something like
    if((toDate.getTime()-fromDate.getTime())/(1000 * 60 * 60 * 24)>30)
      return true;
    else
      return false;-Arun
    P.S : Above example calculates based on number of Days (30). If you want 3 months, you need to put a logic - Simply 90 days? What about the months with 31 days and 28/29 days? etc.

  • How can i organise that my website has an icon before the name when someone puts it on his bar or tab?

    I am a small publisher that wants to improve his website.
    How can I organise that an icon links to my website name when you put it on a bar/tab?

    IMP_ATGordon wrote:
    ... there's just a blank space where the .flv should be. (This also happens on computers running XP and Mac OSX.)
    To clarify, it's the problem of inconsistency that persists. That is, the application displays fine on some XP computers, but not on others.

  • How can I get the start date and end date of a certain week?

    Hello, in my java code, I can get the week ID , using
    org.joda.time.base.AbstractDateTime.getWeekOfWeekyear() , for example, this week is the 16th week of this year. And I want to get the start date(date of Monday) and end date(date of Sunday) of the week. Is there any method can supply such date value??thanks

    1 public Date getCurrentMonday(){
    2 Date monday = null;
    3 Calendar rightNow = Calendar.getInstance();
    4 int day = rightNow.get(Calendar.DAY_OF_WEEK);
    5 int distance = 0;
    6
    7
    8 if (day == Calendar.MONDAY)
    9 monday = rightNow.getTime();
    10 else
    11 {
    12 distance = day - Calendar.MONDAY;
    13 if (distance == -1)
    14 distance = 6;
    15
    16 monday = (Date) (rightNow.getTime());
    17 monday.setTime(monday.getTime() - 1000 *60 *60 *24 *(distance));
    18 }
    19 return monday;
    20 }

  • How can I validate that a calculated field equals a specific number?

    Thanks in advance for your input and advice. I have a calculated field that adds up the sum of two percentages (e.g 25% and 50%). I want to validate the sum of those percentages equals 100%. Thanks, Any help would be appreciated.

    Thanks for your response. If the sum of the values in the calculated field does not equal 100%, an alert should appear to indicate that the sum of those fields must equal 100%. As far as checking whether both of the fields being calculated, that is not as important; only one of those fields could have an entry as long as it equals 100%.  Does that help? Thanks again for your help.

  • How can i get the previous date?

    Hi,
    I am entering a future date(xx-xx-xxxx) through my application.I need to perform some actions on the previous date of the entered date(xx-xx-xxxx).How can i get that previous date?

    Oh dear god.
    Parse the date using SimpleDateFormat. You can then use Calendar's setTime to set a Calendar instance to your date, and use add(Calendar.DAY_OF_MONTH, -1) to substract a day. getTime() will then provide a new Date. And yes, look it up in the API docs.

  • How can I validate an X509Certificate ?

    I'm not really sure of what makes a certain cetificate different from a certificate that I create in my comupter... I mean, how can I validate that a certain certificate belongs to the entity it says it belongs to?
    Is my question clear enough?
    I hope someone can help me with this...

    Hello,
    You do not validate certificates per say, they are either valid or they are not.
    Certificates contain a certificate chain/path leading back to a certification authority. Your computer/java has a list of trusted authorities. If the afore mentioned path does not lead back to one of them, authenticity (of software/documents) amongst other things can not be gauranteed. In this case, you would contact the publisher of the cert and verify it is them by comparing keys.
    Yes you can create you own certificate and distribute it, but you will be the one to handle all requests to verify that the pub.key in the cert is actually yours.
    I hope this has cleared it up... and is accurate for that matter (if anyone cares to point out).
    Warm regards,
    Darren

  • How can I validate a date field in Portal Forms

    I have a date field in portal forms that I want to perform validation on to make sure it's in the proper format before being accepted (mm/dd/yyyy). How can I validate against that field?

    Hi Ben,
    I took the time to test and revise. This is code that will validate a date entry (format MM/DD/YYYY). Just paste this in the "Before the start of the form..." window of the Additional PL/SQL code section of the form. Then add validateDate(); into the onBlur event window of the field in question. Replace the CYCLE_END_DATE with the field name in question.
    HTP.P('
    <SCRIPT LANGUAGE=javascript>
    function validateDate() {
    var ddObj;
    var mmObj;
    var yyObj;
    var day;
    var mon;
    var year;
    var field_val;
    var field_name;
    for (var j=0; j < document.forms[0].elements.length; j++) {
    field_name = document.forms[0].elements[j].name;
    field_val = document.forms[0].elements[j].value;
    if (field_name.substring(field_name.indexOf(''DEFAULT.'') + 8, field_name.lastIndexOf(''.01'')) == ''CYCLE_END_DATE'') {
    var delimPos = field_val.search(/\//i);
    if (delimPos < 0)
    alert(''Invalid date entry! Please enter in MM/DD/YYYY format. '' +
    ''e.g, Dec 21, 2003 would be entered as 12/21/2003'');
    else
    if (field_val.length != 10)
    alert(''Invalid date entry! Please Please enter in MM/DD/YYYY format. '' +
    ''e.g, Jan 1, 2003 would be entered as 01/01/2003'');
    else {
    month = field_val.substring(0, field_val.indexOf(''/''));
    day = field_val.substring(field_val.indexOf(''/'') + 1, field_val.lastIndexOf(''/''));
    year = field_val.substring(field_val.lastIndexOf(''/'') + 1, 10);
    /* Need to subtract 1 from value because in Javascript, January begins with 0
    and ends with 11 for December */
    month = month - 1;
    ddObj = new Date(year, month, day);
    mmObj = new Date(year, month, day);
    yyObj = new Date(year, month, day);
    if (ddObj.getDate(ddObj.setDate(day)) != day)
    alert(''Invalid day!'');
    if (mmObj.getMonth(mmObj.setMonth(month)) != month)
    alert(''Invalid month!'');
    if (mmObj.getYear(mmObj.setYear(year)) != year)
    alert(''Invalid year!'');
    </SCRIPT>
    ');

  • How can I validate a date using sql

    How can I validate a date using sql or pl/sql
    select to_date('01/01/2009','mm/dd/yyyy') from dual this is a good date
    but how can I check for a bad date
    select to_date('0a/01/2009','mm/dd/yyyy') from dual
    Howard

    William Robertson wrote:
    It'll be complicated in pure SQL, as you'll have to parse out day, month and year and then validate the day against the month and year bearing in mind the rules for leap years. It would be simpler to write a PL/SQL function and call that.Nah, not that complicated, you just need to generate a calender to validate against.
    SQL> ed
    Wrote file afiedt.buf
      1  with yrs as (select rownum-1 as yr from dual connect by rownum <= 100)
      2      ,mnth as (select rownum as mn, case when rownum in (4,6,9,11) then 30
      3                            when rownum = 2 then 28
      4                       else 31
      5                       end as dy
      6                from dual
      7                connect by rownum <= 12)
      8      ,cent as (select (rownum-1) as cen from dual connect by rownum <= 21)
      9      ,cal as (select cen, yr, mn,
    10                      case when ((yr = 0 and mod(cen,400) = 0)
    11                             or (mod(yr,4) = 0 and yr > 0))
    12                            and mn = 2 then dy+1
    13                      else dy
    14                      end as dy
    15               from cent, yrs, mnth)
    16  --
    17      ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    18  --
    19  select case when cal.cen is null then 'Invalid Date'
    20              when not regexp_like(dt,'^[0-9]{1,2}[\/.-_][0-9]{1,2}[\/.-_][0-9]{4}$') then 'Invalid Date'
    21         else dt
    22         end as dt
    23  from dt left outer join
    24               cal on (to_number(regexp_substr(dt,'[0-9]+')) between 1 and cal.dy
    25                   and to_number(regexp_substr(dt,'[0-9]+',1,2)) = cal.mn
    26                   and floor(to_number(regexp_substr(dt,'[0-9]+',1,3))/100) = cal.cen
    27*                  and to_number(substr(regexp_substr(dt,'[0-9]+',1,3),-2)) = cal.yr)
    SQL> /
    Enter value for date_dd_mm_yyyy: a1/02/2008
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select 'a1/02/2008' as dt from dual)
    DT
    Invalid Date
    SQL> /
    Enter value for date_dd_mm_yyyy: 01/02/2008
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '01/02/2008' as dt from dual)
    DT
    01/02/2008
    SQL> /
    Enter value for date_dd_mm_yyyy: 29/02/2008
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '29/02/2008' as dt from dual)
    DT
    29/02/2008
    SQL> /
    Enter value for date_dd_mm_yyyy: 30/02/2008
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '30/02/2008' as dt from dual)
    DT
    Invalid Date
    SQL> /
    Enter value for date_dd_mm_yyyy: 29/02/2009
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '29/02/2009' as dt from dual)
    DT
    Invalid Date
    SQL> /
    Enter value for date_dd_mm_yyyy: 28/02/2009
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '28/02/2009' as dt from dual)
    DT
    28/02/2009
    SQL> /
    Enter value for date_dd_mm_yyyy: 0a/01/2009
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '0a/01/2009' as dt from dual)
    DT
    Invalid Date
    SQL> /
    Enter value for date_dd_mm_yyyy: 00/01/2009
    old  17:     ,dt as (select '&date_dd_mm_yyyy' as dt from dual)
    new  17:     ,dt as (select '00/01/2009' as dt from dual)
    DT
    Invalid Date
    SQL>

  • The hard disc of my laptop has crashed and i lost all the data. Now I want to take back up of my I phone and transfer contacts , messages and music back into my laptop , how can I do that. Pl help

    The hard disc of my laptop has crashed and i lost all the data. Now I want to take back up of my I phone and transfer contacts , messages and music etc back into my laptop , how can I do that. Also let me know how I can transfer the contacts into Windows contacts from I phone. Pl help

    Your content will only be where you put it.  It has always been very basic to always maintain a backup copy of your computer.
    You can transfer itunes purchases from your iphone: File>Device>Transfer purchases.
    You can import your pics taken with the iphone as you would with any digital camera.
    You can e-mail the other pics to yourself, they will never be of the original quality.
    You can out a unique contact and calendar entry on the computer.  You should get the option to merge the data when you sync.

  • I am receiving the data through the rs232 in labview and i have to store the data in to the word file only if there is a change in the data and we have to scan the data continuasly how can i do that.

    i am receiving the data through the rs232 in labview and i have to store the data in to the word or text file only if there is a change in the data. I have to scan the data continuasly. how can i do that. I was able to store the data into the text or word file but could not be able to do it.  I am gettting the data from rs232 interms of 0 or 1.  and i have to print it only if thereis a change in data from 0 to 1. if i use if-loop , each as much time there is 0 or 1 is there that much time the data gets printed. i dont know how to do this program please help me if anybody knows the answer

    I have attatched the vi.  Here in this it receives the data from rs232 as string and converted into binery. and indicated in led also normally if the data 1 comes then the led's will be off.  suppose if 0 comes the corresponding data status is wrtten into the text file.  But here the problem is the same data will be printed many number of times.  so i have to make it like if there is a transition from 1 to o then only print it once.  how to do it.  I am doing this from few weeks please reply if you know the answer immediatly
    thanking you 
    Attachments:
    MOTORTESTJIG.vi ‏729 KB

  • Me and my wife both have iPhone for iTunes I use same laptop now our contacts are all mixed up. I want to delete our old synchronize a/c. To start up freshly. How can I do that?

    Me and my wife both have iPhone for iTunes I use same laptop now our contacts are all mixed up. I want to delete our old synchronize a/c. To start up freshly. How can I do that?

    Anyone at all can advise- still not sorted :-(

  • HT4910 I have a simple question or 2. 1) how can I see what is on my icloud and how do I edit the data if I do not want it on icloud. 2) I have an app that I would like to update data - it doesn't appear to be doing that, how can I fix that? It is the mob

    1) how can I see what is on my icloud and how would I edit the data that is on it?
    2) I am having problems with an app syncing data with pc - how can I fix that? It is mobile noter.

    Welcome to the Apple Community.
    You can see what's in iCloud collectively at settings > iCloud > storage & back up > manage.... You can only edit the data through the appropriate app (contacts, calendars etc)
    For problems with 3rd party apps, contact the developer.

  • Hi...i bought the new iphone 4 and would like to ask how can i transfer all my data from my old iphone to the new one?  If I will do "synchronization" through itunes with the old phone and the plug in the new one will that be the case?

    Hi...i bought the new iphone 4 and would like to ask how can i transfer all my data from my old iphone to the new one?  If I will do "synchronization" through itunes with the old phone and the plug in the new one will that be the case?

    Follow the instructions in this article to transfer your info: iPhone: Transferring information from your current iPhone to a new iPhone

Maybe you are looking for

  • DNS for exchange 2010

    I have set up exchange 2010 for a home lab. My internal domain name is domain.local and my external domain name is domain.info. OWA works internally using https://servername/owa. My question is how do I get OWA working with my external FQDN from outs

  • Searching a file in application server

    Hi Guys , Any ways by which i can search a file passed in my program in the sap network ... reagrds.

  • Micro SDXC 64 GB on Xperia T2 Ultra Dual

    Hello, Just got myself a Sandisk 32 GB Xtreme MicroSDHC..running about a week from now on my Xperia T2 ulta Dual without hiccups I wonder if 64GB SDXC is supported by this phone?Has anyone outhere try it out?I mean plugging it in and the phone recogn

  • Oracle Application Request number informations

    Can you show me a pl/sql procedure to see all informations about a specified concurrent request, giving your request_id number ? @c:\show_request 31810589 I´d like see an Oracle Application Request number, in a line command. In Oracle Application for

  • Using clob in sql loader utility in oracle 9i

    Hi, I want to load data into a table with 2 clob columns using a sql loader utility dat file and control file created programatically. The size of clob in dat file can change and the clob columns are inline in data file. As per 9i doc the size of clo