tags:

views:

328

answers:

2

Hi. I want to create an error handler for a mvc project, but the error message should be displayed in a popup. I tried to override onException event of the controller, but I don't know how to get back to the initial page and show the popup. I don't want to be redirected to an error page. Any advices?

A: 

The only way to do this is to do an AJAX form submission. If the save fails, show a popup. If the save succeeds redirect the user to a new page. That's the only way to keep the user on the page. (Well the only non-clunky way.)

As mentioned in the top-level comment by zvolkov, this is very desktop-y. There shouldn't be a 100% correlation to how a desktop program works vs. how a web program works. While there are parallels, it's OK to deviate.

The hardcore standards folks will tell you to not rely 100% on an AJAX submit, since it isn't 100% browser compatible and can break on some smartphones, depending on what you're doing. You form should be able to gracefully fall back to a standard HTTP-POST action.

Jarrett Meyer
A: 

jQuery Validation plugin

Phill Pafford