How to redirect after popup closes

Hi,

In my application, when user clicks on a link, I need to show a form in
a popup window. Popup has to close when form is submitted. If the form
data is valid then I need to go to action A in main browser else I need
to go to action b. how do I do it i.e. redirect the main window?

Thanks.

I think it’s something like “parent.location = …” in the onload
function of your popup… google should be able to fill in the detail
nicely.

b

But the form is submitted to an action in rails. From my rails action,
view A or B appear in popup. what I need is that popup should close when
form is submitted, and the main browser should either be redireced to A
or B.

Ben M. wrote:

I think it’s something like “parent.location = …” in the onload
function of your popup… google should be able to fill in the detail
nicely.

b

Form gets submitted -> depending on wiehter form was valid or not,
rails will render a (slightly) different view.
it should render something like this:

... your view's body code here ...

not sure if my Javascript is 100% correct, but you should get the idea
and google should do the rest, you wil find much about parent &
location easily.

Thanks. It worked.

Thorsten L wrote:

Form gets submitted -> depending on wiehter form was valid or not,
rails will render a (slightly) different view.
it should render something like this:

... your view's body code here ...

not sure if my Javascript is 100% correct, but you should get the idea
and google should do the rest, you wil find much about parent &
location easily.