Popup Form. When I use refreshOnSuccess: true - I get a browser popup

Feb 3, 2011 at 10:18 AM

I use a Popup form to add data. In the popup controller I make a call to update the database.

When I leave the popup form, I want the underlying form to referesh.

So I was please to see a refreshOnSuccess attribute and I decided to set that to true;

        <%: Html.MakePopupForm<SHP.Controllers.LeaveController>(o => o.SingleDate(Model.EmployeeId), refreshOnSuccess: true)%>

However what happens is that I get a popup message from the browser asking me to resend the form.

So how do I stop that from happening? I just want the page to refresh without that.

Feb 3, 2011 at 12:21 PM

that's what usually happens when you try to refresh page that has just posted a form

you could set refreshOnSuccess: false and hit refresh manually and you would still get that


this could help you :


basically you need to change the way you write your app

Feb 3, 2011 at 1:13 PM
Edited Feb 3, 2011 at 1:36 PM

I tried using the client side SuccessFunction but that does not work.


        <%: Html.MakePopupForm<SHP.Controllers.LeaveController>(o => o.SingleDate(Model.EmployeeId), successFunction: "location.reload();")%>


The intention is that location.reload(); will invoke the HttpGet method on the controller. I suspect it doesn't really work that way.

Feb 3, 2011 at 8:22 PM

in order to avoid this browser popup just never return View() from an Action that is HttpPost except when you do this when ModelState.IsValid = false

Feb 4, 2011 at 9:30 AM

I see, just like the link suggests, use the POST-Redirect-GET pattern.

Now it is working which is good.

I think my HttpGet method needs some refactoring because I am using various types of temporary storage and if statements, but that is a different problem.