Re: Adding a class to a div based on field validation status

2012-07-18 Thread Alex Kotchnev
Lance, thanks for the sample mixin code : I hadn't created any mixins previously and this was a great start. It works like a charm. Thiago, I did think of using the Validation decorator; however, at least for now it looked a bit of an overkill as I'm not 100% sure if this is going to be the

Re: Adding a class to a div based on field validation status

2012-07-18 Thread Thiago H de Paula Figueiredo
On Wed, 18 Jul 2012 10:32:49 -0300, Lance Java wrote: Has anyone thought of a ValidationDecorator? Nope... never heard of it... time to jump into the tapestry code / javadocs again ;) Or the mailing list archives. We've had some interesting threads involving ValidationDecorator already.

Re: Adding a class to a div based on field validation status

2012-07-18 Thread Lance Java
> Has anyone thought of a ValidationDecorator? Nope... never heard of it... time to jump into the tapestry code / javadocs again ;) -- View this message in context: http://tapestry.1045711.n5.nabble.com/Adding-a-class-to-a-div-based-on-field-validation-status-tp5714526p5714553.html Sent from the

Re: Adding a class to a div based on field validation status

2012-07-18 Thread Thiago H de Paula Figueiredo
On Wed, 18 Jul 2012 06:38:44 -0300, Lance Java wrote: I think I would do it via a mixin on the textfield. Has anyone thought of a ValidationDecorator? -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsub

Re: Adding a class to a div based on field validation status

2012-07-18 Thread Lance Java
eg: package foo.bar.mixins; @MixinAfter public class ControlGroupDecorator { @InjectContainer private Field field; @Environmental(false) private ValidationTracker tracker; private Element controlGroup; public void afterRender(MarkupWriter writer) { // need

Re: Adding a class to a div based on field validation status

2012-07-18 Thread Lance Java
I think I would do it via a mixin on the textfield. Where the ControlGroupDecorator walks up the DOM to the first div with a class="control-group" and adds the error class if necessary (using the t:id of the textField to see which errors to check for). -- View this message in context: http://

Re: Adding a class to a div based on field validation status

2012-07-17 Thread Alex Kotchnev
I ended up figuring out something that works and it turned out to be both more elegant (as it ends up being more clean and reusable than I expected) and a bit more twisted ( I totally didn't expect that I'd have to use this @HeartbeatDeferred approach, I expected something more straightforward) tha