Hi,

a somewhat related question. It's now possible thanks to the Decorator for my webapp to display validation bubbles after a form submit. I'd also like to be able to set an error somewhere in the beginning of the rendering process and have it show. I'm having a hard time figuring out how to accomplish this. By the time setupRender or beginRender occurs, it seems the form.recordError(String) method and its overload do not affect the current render cycle.

I tried doing something along the lines of dumping the first render cycle, returning false at a late render cycle and going back through, but that doesn't seem to do anything useful.

To give more perspective, my application manages a session timer, and when the timeout occurs the user gets booted to the main page. As before I don't want to introduce more text to the page and would prefer to have the login form of the main page grab the user's focus with a "Session has timed out" pop up bubble.

I am passing an activation context to the main page, and having this pipe into the login component via a parameter. The trouble is what can I do within the Login component to display the popup error when it becomes aware the parameter for the session timeout is triggered.

Thanks,
Rich

On 08/12/2010 10:40 AM, Rich M wrote:
Thanks Josh,

that was exactly what I was looking to do. Hopefully I'll be able to start seeing these things on my own sometime soon!

-Rich

On 08/11/2010 08:11 PM, Josh Canfield wrote:
If you are looking to get the error bubble to pop up after you submit
the form you could use this:

public class BubbleValidationDecorator extends BaseValidationDecorator {
     private final Environment _environment;

     private final RenderSupport _renderSupport;

     public BubbleValidationDecorator(Environment environment,
                                      RenderSupport renderSupport) {
         _environment = environment;
         _renderSupport = renderSupport;
     }

     public void afterField(Field field) {
         final ValidationTracker validationTracker =
_environment.peekRequired(ValidationTracker.class);
         if (validationTracker.inError(field)) {
             _renderSupport.addScript(

"$('%s').getFieldEventManager().showValidationMessage('%s');",
field.getClientId(), validationTracker.getError(field));
         }
     }
}


Add to AppModule:





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to