You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by mi...@sonynetservices.com on 2002/07/19 11:26:47 UTC

[SUMMARY]XMLForm, extended validation and error messages

Hi Ivelin,

   thanks again for your provided solution.
   Before summing up what I did, please change the code that you provided,
as if
   it is used as is you will get a Null Pointer Exception, due to the
following
   code:
      public void addViolations( List newViolations )  {
            if (violations_  == null)
            ...........
      }
Please change to:
            if(violations_ != null)

The rest is really easy to do:

In the perform() method of your RegistrationAction just do your customized
validation and then
create a new Violation and send back the actual page again:

      Violation v = new Violation();
      v.setMessage(errMsg);
      v.setPath("/firstName");
      violations.add(v);
      getForm().addViolations(violations);
      return page(getFormView());

Thanks again for your great help,

miHam







---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: [SUMMARY]XMLForm, extended validation and error messages

Posted by Ivelin Ivanov <iv...@apache.org>.
----- Original Message -----
From: <mi...@sonynetservices.com>
To: <co...@xml.apache.org>
Sent: Friday, July 19, 2002 4:26 AM
Subject: [SUMMARY]XMLForm, extended validation and error messages


> Hi Ivelin,
>
>    thanks again for your provided solution.
>    Before summing up what I did, please change the code that you provided,
> as if
>    it is used as is you will get a Null Pointer Exception, due to the
> following
>    code:
>       public void addViolations( List newViolations )  {
>             if (violations_  == null)
>             ...........
>       }
> Please change to:
>             if(violations_ != null)

Ooops. That shows how good I am at details ...
Patch applied.
Thank you.


Ivelin

>
> The rest is really easy to do:
>
> In the perform() method of your RegistrationAction just do your customized
> validation and then
> create a new Violation and send back the actual page again:
>
>       Violation v = new Violation();
>       v.setMessage(errMsg);
>       v.setPath("/firstName");
>       violations.add(v);
>       getForm().addViolations(violations);
>       return page(getFormView());
>
> Thanks again for your great help,
>
> miHam
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>