• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Validation errors inside a sub-component
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Validation errors inside a sub-component


  • Subject: Re: Validation errors inside a sub-component
  • From: Ramsey Lee Gurley <email@hidden>
  • Date: Thu, 05 Nov 2009 21:22:11 -0500

Maybe drop all your validation handling into your page component instead and then you can get at it with context.page? Extra bonus: use the same page super class everywhere and your validation handling is done in one place for your entire app. (^_^)

Ramsey

On Nov 5, 2009, at 9:12 PM, Pascal Robert wrote:

I'm trapping validation errors like this :

   private String error;

public void validationFailedWithException(Throwable exception, Object value, String keyPath) {
errors.addObject(exception.getMessage());
}


   public String error() {
   	return error;
   }

   public void setError(String error) {
   	this.error = error;
   }

And in my component, I had this :

 <wo:AjaxUpdateContainer id = "saveState" fullSubmit = true>
 <wo:ERXWOConditional condition = "$hasErrors">
     <div class = "warning">
       <p><wo:ERXLocalizedString value = "Errors.Header" />:</p>
       <wo:WORepetition list = "$errors" item = "$error">
         <wo:WOString value = "$error" escapeHTML = "false" />
         <br />
       </wo:WORepetition>
     </div>
 </wo:ERXWOConditional>
 <wo:ERXElse>
   <wo:WOString value = "$succesString" />
 </wo:ERXElse>
 </wo:AjaxUpdateContainer>

That was working fine when this code was directly in my components, but having the same stuff inside multiple components is not good, so I moved this logic to a sub-component, and I'm calling this sub- component from all my other components. Problem is, the sub- component is called (if I put static text before the conditional, I see it when I submit the form) but no errors are showing up and the repetition don't iterate over the array. A breakpoint in validationFailedWithException does show that the error is being added to the array, so I have no idea on why it's not displaying anything when it's in the sub-component.

BTW, validationFailedWithException is inside a superclass that every component inherits from.

WO 5.4.3/ERExtensions from the current source.

--

-------------------------------------------------------
Pascal Robert

http://www.macti.ca
http://www.linkedin.com/in/macti

Skype: MacTICanada
AIM/iChat : MacTICanada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
@mac.com


This email sent to email@hidden

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Validation errors inside a sub-component
      • From: Andrew Lindesay <email@hidden>
References: 
 >Validation errors inside a sub-component (From: Pascal Robert <email@hidden>)

  • Prev by Date: Validation errors inside a sub-component
  • Next by Date: Re: Validation errors inside a sub-component
  • Previous by thread: Validation errors inside a sub-component
  • Next by thread: Re: Validation errors inside a sub-component
  • Index(es):
    • Date
    • Thread