• Post Reply Bookmark Topic Watch Topic
  • New Topic

[Resolved] Show Popup then Refresh Form

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a form with several dropdowns and I am adding a button beside each dropdown list that is visible only to admins that allows the admin to Add an item to the dropdown. I have built the form that adds the item to the database. What I need to do now is call this form by clicking a button and displaying a popup window. When the new item is added, I need to refresh the calling form.

Can someone please point me in the right direction. I have never done this type of thing before and add JSF on top of that...I'm not asking for a solution, just a nudge in the right direction, ie - web sites, tutorials, etc.

Thanks.
[ January 11, 2005: Message edited by: Gregg Bolinger ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I got the popup to show and I got the calling page to refresh, however, when it refreshes it asks me about the fact that there is POSTDATA. Is there a way to basically say yes to this automagically? Or do I need to be doing this differently? Is this even possible?
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gregg Bolinger:
Ok, I got the popup to show and I got the calling page to refresh, however, when it refreshes it asks me about the fact that there is POSTDATA. Is there a way to basically say yes to this automagically? Or do I need to be doing this differently? Is this even possible?


How are you refreshing the base page?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by K Varun:


How are you refreshing the base page?


opener.window.location.reload()
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe the only way to by-pass the browser's prompt regarding POSTDATA is to do a redirect after the POST so that when your JavaScript does reload(), the browser will reload a page that was fetched using regular HTTP GET instead of the POST.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try doing this instead:

opener.window.location.href = opener.window.location.href;

Depending on the browser, it may loose the values in the form fields. The same can also happen with the reload() method too.

Eric
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lasse Koskela:
I believe the only way to by-pass the browser's prompt regarding POSTDATA is to do a redirect after the POST so that when your JavaScript does reload(), the browser will reload a page that was fetched using regular HTTP GET instead of the POST.


Well, that's just nasty.
 
Varun Khanna
Ranch Hand
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gregg Bolinger:


Well, that's just nasty.


I will give you another dodgy solution

Instead of reload, use this :
opener.window.document.[somebutton].click()
P.S. Please verify the syntax of above line (am not sure)

Hide this button using a DHTML, so won't be visible. and in the backing bean's action method (binded with this button), just return "success".
[ January 11, 2005: Message edited by: K Varun ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eric Pascarello:
Try doing this instead:

opener.window.location.href = opener.window.location.href;

Depending on the browser, it may loose the values in the form fields. The same can also happen with the reload() method too.

Eric


It does reset form fields, but that will work well enough. Thanks.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
.click() is not browser friendly, do not do it!

LOL
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It does reset form fields, but that will work well enough. Thanks.

A way around the problem is storing information in a session cookie and placing the values back in to it so you do not loose them.

Eric
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Eric Pascarello:
It does reset form fields, but that will work well enough. Thanks.

A way around the problem is storing information in a session cookie and placing the values back in to it so you do not loose them.

Eric


And since JSF is kind enough to do this for me if I submit the form with no navigation rule, works like a champ!!! Thanks Eric.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!