Peter Stavrinides <p.stavrini...@albourne.com> schrieb am 06.10.2009 
09:07:53:

> Validation question - at which point are property values set before post

They seem to be set after the input field validators complete.
> 
> //This code works
> public void onSuccess() throws SQLException {
> 
>       if(isTerminated()){
>          if(personnelData.getEndDate() == null){ 
>             employeeform.recordError("End date is required");
>             return;
>          }
>       }
> ...
> }

On success is fired after the validation succeeded, so the properties are 
set.

> 
> //And this code doesn't because the property personnelData.getEndDate
> () appears to not have been set yet!
> 
> void onValidateFromEndDate(){
>    if(isTerminated()){
>       if(personnelData.getEndDate() == null){
>          employeeform.recordError("End date is required");
>       }
>    }
> }

In the field validators, the corresponding properties are not set yet. You 
can get the value via a parameter:

void onValidateFromEndDate(String theDate) { ... }

If you don't use a String parameter, the type will be coerced to the class 
you specified. I'm not sure which class works best for your endDate, maybe
void onValidateFromEndDate(Date theDate) { ... }

HTH, Dirk
BGS Beratungsgesellschaft 
Software Systemplanung AG         Niederlassung Köln/Bonn 
Grantham-Allee 2-8 
53757 Sankt Augustin 
Fon: +49 (0) 2241 / 166-500 
Fax: +49 (0) 2241 / 166-680 
www.bgs-ag.de Geschäftssitz Mainz 
Registergericht 
Amtsgericht Mainz 
HRB 62 50 
  Aufsichtsratsvorsitzender 
Klaus Hellwig 
Vorstand 
Hermann Kiefer 
Nils Manegold 
Thomas Reitz 


  

Reply via email to