No problem, it's the least I can do. :) https://cwiki.apache.org/confluence/display/WICKET/Automatic+styling+of+form+errors
On Thu, Jul 21, 2011 at 12:02 PM, Igor Vaynberg <[email protected]>wrote: > your attachment didnt make it through :( > > maybe put it on our wiki. > > thanks, > -igor > > > On Thu, Jul 21, 2011 at 12:00 PM, Dan Retzlaff <[email protected]> > wrote: > > Awesome, works beautifully! This solves one of the biggest Wicket > headaches > > for our form-heavy application. Components no longer have to worry about > > what to render when forms have errors, or how to clear those errors on > > success. It's even more magical than the automatic AJAX feedback > rendering. > > :) > > By the way, rather than render components unconditionally (to clear > errors), > > I add a MetaData object mark components that received an error styling on > > the previous request. I'd encourage anyone developing an app with lots of > > validation to consider the attached. > > Dan > > > > On Wed, Jul 20, 2011 at 9:48 PM, Igor Vaynberg <[email protected]> > > wrote: > >> > >> On Wed, Jul 20, 2011 at 9:11 PM, Dan Retzlaff <[email protected]> > wrote: > >> > Hey it's the man himself. :) > >> > > >> > We already use the automatic AJAX feedback recipe (thanks for that), > but > >> > I'm > >> > not sure how that solves the problem at hand. I only add the temporary > >> > behaviors in myIComponentOnBeforeRenderListener, and that only gets > >> > called > >> > if the component's *already* been added to the ART. If the behavior > >> > weren't > >> > temporary then your suggestion makes sense, assuming we're okay with > >> > visiting the entire page for every AJAX request. But once we've paid > >> > that > >> > cost, why not just add the temporary behavior during visitation? > >> > > >> > I suppose I don't mind scouring the component graph for invalid > >> > FormComponents if and only if > !Session.getFeedbackMessages().isEmpty(). > >> > Do > >> > you agree with this approach, or am I missing your point? > >> > >> scouring the component graph is cheap. look for all > >> formcomponentlabels and update them. you have to do this even if there > >> are no errors because the formcomponent might have been invalid in the > >> previous submit and now is valid. > >> > >> -igor > >> > >> > > >> > Regards, > >> > Dan > >> > > >> > On Wed, Jul 20, 2011 at 8:15 PM, Igor Vaynberg > >> > <[email protected]>wrote: > >> > > >> >> no worries, the cookbook has your back! > >> >> > >> >> look in this recipe: Providing Ajax feedback automatically > >> >> > >> >> have your temporary behavior implement a tagging interface. then in > >> >> the ajax request target listener look for all components that have a > >> >> behavior with this tagging interface, and if they do add it to the > >> >> target. > >> >> > >> >> -igor > >> >> > >> >> > >> >> On Wed, Jul 20, 2011 at 8:01 PM, Dan Retzlaff <[email protected]> > >> >> wrote: > >> >> > Hey all, > >> >> > > >> >> > I want a low-interference approach to adding CSS class attributes > to > >> >> > form > >> >> > components and their labels when they have associated errors. > Igor's > >> >> > * > >> >> > Cookbook* suggests a behavior, but leaves the automation as > something > >> >> done > >> >> > during page construction. We have too many AJAX modals and panel > >> >> > updates > >> >> for > >> >> > this to cover everything. Therefore I wrote > >> >> > an IComponentOnBeforeRenderListener that adds temporary behaviors > to > >> >> > FormComponents and FormComponentLabels which has me pretty close to > >> >> nirvana. > >> >> > However, the problem remains of getting the form components (or at > >> >> > least > >> >> the > >> >> > form) added to AjaxRequestTargets. It seems like I want an > >> >> application-level > >> >> > form submit listener, but I'm not sure how to approach that. > >> >> > > >> >> > Any suggestions or criticisms? This would be awesome for us to get > >> >> working. > >> >> > > >> >> > Dan > >> >> > > >> >> > >> >> --------------------------------------------------------------------- > >> >> To unsubscribe, e-mail: [email protected] > >> >> For additional commands, e-mail: [email protected] > >> >> > >> >> > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
