Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2104
  • Last Modified:

How to auto close a popup and refresh the parent page in JSF?

I have requirement where in the parent page a link is provided.Onclick of a link,it will open a new popup jsp and will populate required fields from the parent jsp.

From the popup,I will do some actions and using command button I will update the database with few business validations.

Now the question is if  I successfully goes through the validations I have to auto close my popup and refresh the parent JSP and if any validation failures,then popup should not be closed,parent page should not be refreshed and validations need to be displayed as a overlay on the popup jsp.

Any help in doing this is completely appreciated.

Thanks,
Sandeep
0
deepuhassan
Asked:
deepuhassan
  • 2
1 Solution
 
Michel PlungjanIT ExpertCommented:
return this to close and update

<script type="text/javascript">
opener.location.reload(1);
window.close();
</script>


If you get issues with this - the opener changed because you load another page, you have two possibilities

1. in main window do
<script type="text/javascript">
 window.name="parentWindow"
</script>

2. in popup do
 <script type="text/javascript">
var w = window.open('','parentPage'); // gets the handle
w.location.reload(1);
window.close();
</script>

OR

have a frameset in the popup and return

<script type="text/javascript">
top.opener.location.reload(1);
window.close();
</script>

0
 
Sathish David Kumar NCommented:
in popoup window
u can wirte this code self.close();
 
0
 
Michel PlungjanIT ExpertCommented:
Same as window.close() as already posted
0
 
deepuhassanAuthor Commented:
I used a part of the soln while implementing
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now