[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Avoid Repot of data on refresh

Posted on 2006-06-14
11
Medium Priority
?
1,657 Views
Last Modified: 2008-01-09
I've poked around and found some sense of what I can do to prevent the issue, but not for my situation.

I have a page with a form on it as well as links to some child pop-up windows.  Opening one of the child pop-ups takes you to an edit form that when submited displays a "Thank you, this page will close in 5 seconds" and then refreshes the Parent window via this function in the child popup
function closeIt(){
       opener.window.location.reload(true);
     setTimeout('JavaScript:window.close()',5000);
}
The problem arises when the user has submited some changes on the parent form first.  Then goes to a child popup, submits the edit form, then the child refreshes the parent and the "Do you want to repost Retry/ignore" window pops up for the parent.  Any ideas how I can make the parent not repost when I refresh it from the child?  I'm working with asp pages that also have some JS in it.
0
Comment
Question by:Nick_Chvr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 16

Expert Comment

by:OliWarner
ID: 16908953
Yeah one easy way is to send the browser to the same page... That's like loading it again rather than refreshing... if you see what I mean...

In physical representation, that's like clicking the "go" button instead of clicking the refresh button.

I'll just dig up some code for you
0
 
LVL 10

Accepted Solution

by:
ClickCentric earned 1200 total points
ID: 16908955
Hmm...not sure if this will work, but I *think* you can redirect the parent window to itself, ie the same address it's currently pointing to.  This would be the same as clicking on the address bar and pressing enter as opposed to refreshing or reloading the page.

Try:

function closeIt(){
      opener.window.location.href = opener.window.location.href;
     setTimeout('JavaScript:window.close()',5000);
}

I can't test it at the moment, but I think it would work.
0
 
LVL 16

Assisted Solution

by:OliWarner
OliWarner earned 800 total points
ID: 16908960
location.href=location.href;

That seems a little easy to me... so I'll just test it and get back to you
0
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 
LVL 16

Expert Comment

by:OliWarner
ID: 16908965
Yes that seems to be working here but I havent tested it after a postback...
0
 
LVL 10

Expert Comment

by:ClickCentric
ID: 16908989
I should mention there's at least one caveat to the method I mentioned that must be considered...if the page has updated itself relative to information that was posted to it, that information would be lost unless it's reposted, so the page loaded would be the original, unmodified page.
0
 
LVL 16

Expert Comment

by:OliWarner
ID: 16909033
The only real way to avoid that is to force the submission of the form with a special value saying the the user didnt click the the submit button and so your system knows not to action the data but reouput it in the form fields...

Its all a bit nasty but I'm not entirely sure what you're trying to achieve by reloading the form anyway.
0
 
LVL 10

Expert Comment

by:ClickCentric
ID: 16909043
I was thinking the same.
0
 
LVL 8

Expert Comment

by:netmunky
ID: 16911986
i often avoid reposting a form with refresh by having the form submit then do a header("Location: /whatever.php");

ie - usersubmit.php:
<?
if($_REQUEST['act'] == submit)
{
  dostuff();
  header("Location /usersubmit.php");
}
?>
<form action="/usersubmit.php">
<input type="hidden" id="act" name="act" value="submit">
...
</form>

this way the last action was a GET request, which does not ask to re-post data if a refresh is called.
0
 
LVL 2

Author Comment

by:Nick_Chvr
ID: 16922486
good posts, let me try some today
0
 
LVL 2

Author Comment

by:Nick_Chvr
ID: 16923133
Click Centric's suggestion was spot on.  Refreshes the page w/o a refresh. Oli Warner thanks for your help as well
0
 
LVL 2

Author Comment

by:Nick_Chvr
ID: 16923137
Edit:Refreshes the page w/o a repost
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Australian government abolished Visa 457 earlier this April and this article describes how this decision might affect Australian IT scene and IT experts.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question