Hi All,
I have requirement to validate two date input fields at detail block(table-panel collection) as below screen shot. If entered wrong data it thorws error. After error message I got, I am keeping the cursor at second row in the detial block. Then it allows to save. How to restrict wrong date data in detail block. where as at header block it is working fine.
I written code at Backing bean of a page.
public void End\_date\_ch(ValueChangeEvent valueChangeEvent){
// System.out.println("End Date-value change event fired"+this.getId1());
RichInputDate v\_st\_dt=this.getId1();
RichInputDate v\_end\_dt=this.getId2();
// System.out.println("start date: "+v\_st\_dt.getValue());
oracle.jbo.domain.Date v\_st\_dt\_val= (oracle.jbo.domain.Date)v\_st\_dt.getValue();
oracle.jbo.domain.Date v\_end\_dt\_val= (oracle.jbo.domain.Date)v\_end\_dt.getValue();
oracle.jbo.domain.Date cur\_dt=(oracle.jbo.domain.Date)new oracle.jbo.domain.Date().getCurrentDate();
// System.out.println("current dt============"+cur\_dt);
if(v\_st\_dt\_val==null) {
v\_st\_dt.setValue(cur\_dt);
// v\_quot\_dt.resetValue();
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(v\_st\_dt);
}else{
// System.out.println("Else part entered");
if(cur\_dt!=null)
{
if(((v\_st\_dt\_val.dateValue()).after(cur\_dt.dateValue()))) {
this.errmsg("Start Date Cannot Be Future Date!", v\_st\_dt.getClientId());
}
}
if(v\_st\_dt\_val!=null)
{
System.out.println("start date validation enters");
if(((v\_st\_dt\_val.dateValue()).after(v\_end\_dt\_val.dateValue()))) {
this.errmsg("Start Date Should Be Less Than End Date!", v\_end\_dt.getClientId());
}
}
if(v\_end\_dt\_val!=null)
{
System.out.println("End date validation enters");
if(((v\_end\_dt\_val.dateValue()).before(v\_st\_dt\_val.dateValue()))) {
this.errmsg("End Date Should Be Greater Than Start Date!", v\_end\_dt.getClientId());
}
}
}
}
Regards
Naren
