Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating Data - Seperate Window? 1

Status
Not open for further replies.

jimoo

Programmer
Jun 2, 2003
1,111
US
I have a webform that has an EDIT button on it to edit customer data. When I press the button it brings up another form and I can save the data. All works well.

The problem I am having is when I press IExplorer’s BACK button, it brings me back to the 2nd form for updating the data, and if I press the BACK button again it brings me to the original data.

I suspect I would be better off open in the 2nd form in a separate window? Any advice or tips on how to do this or handle this?


Jim Osieczonek
Delta Business Group, LLC
 
jimoo,

Don't know if this is a good solution for you, buy you could have the form reset on page load... Again, don't know if that's applicable in your case.

Here's a sample code

Code:
<HTML>
<HEAD>
  <TITLE>Just another form...</TITLE>
  <SCRIPT LANGUAGE=&quot;JavaScript&quot;>
    function rstForm() {
      document.myForm.reset();
    }
  </SCRIPT>
</HEAD>
<BODY onLoad=&quot;rstForm()&quot;>
<FORM NAME=&quot;myForm&quot;>
  <SELECT NAME=&quot;opts&quot;>
    <OPTION VALUE=&quot;1&quot;>1</OPTION>
    <OPTION VALUE=&quot;2&quot;>2</OPTION>
    <OPTION VALUE=&quot;3&quot;>3</OPTION>
  </SELECT>
  <INPUT NAME=&quot;yourName&quot; TYPE=&quot;text&quot; SIZE=&quot;40&quot;>
  <INPUT TYPE=&quot;submit&quot; VALUE=&quot;Next ...&quot;>
</FORM>
</BODY>
</HTML>

Good Luck §;O)


Jakob
 
Thanks for the reply dkdude.

That may work. Here is the link to my site if you care to look at the issue in action.


Press the first link, “Retrieve / Update Sample Customer Data “ and you will notice it brings up some sample data in a table. Press the Edit text to the right. It brings up an HTML document and you can make changes. Make a change and press the SUBMIT button. The form is closed.

The problem is:

1) If I press the back button, I get the edit form again, and I’d rather not.
2) If I press the back button one more time it brings up the original data.

What I'd like to see if I press the back button after making my changes is that I go back to
I could insert your code to refresh the form, and that may take care of the data refresh issue. There are a couple of issues with that though.

1.) The code is generated programmatically and I would need to change the process that is generating the code so it included the code you provided.

2) It would poll the server again to retrieve the data.

Any other thoughts?

Ps. I like the sample you provided and can see some nice uses for it. Definitely worth a *


Jim Osieczonek
Delta Business Group, LLC
 
Hi Jim,

Happy New Year & Thanks for the *.

I had a look at your project and do see the problem.

Here's what I would do:

Use my suggested approach (the form-reset on load) in the edit form. That will take care of the first back-button-problem.

For the next back-button-problem: I would go for another solution, that I've used to fix a similar browser-cache problem...

&quot;Tricking the browser to think that it is a new page that's requested&quot; is a nice way to do it. How? Just add an image (company logo or whatever) on the page you need to refresh unconditionally. After the IMG SRC-link to the image file you add a parameter. The parameter must change every time the link appears so the browser recon it a new page.

I've used a PHP script to do that. It can look something like this:

Code:
<?php
function myImg() {
  echo &quot;<IMG SRC=\&quot;[URL unfurl="true"]http://www.deltabg.com/img/logo.gif?[/URL]
Code:
rand=
Code:
&quot;;
  $randomNumber = rand (0,32767);
  echo &quot;$randomNumber\&quot;>\n&quot;;
}
?>

The parameter is marked with red in the example. Just place the call to myImg() somewhere in your page.

... it will produce something like

Code:
<IMG SRC=&quot;[URL unfurl="true"]http://www.deltabg.com/img/logo.gif?rand=16795&quot;>[/URL]

... in the HTML code, which makes absolutely no sense. However, the image is shown AND the page is requested from the server again, hence, the contents will be updated!

This should take care of your problem!

Of course you can do it in other languages. In fact, doing it in JavaScript may be better for your purpose!

If you manage to write it in JavaScript then post it back so I can have a look at it, thanks!

Hope this isen't too confusing... ?!

Let's hear whar you think so far!

Best Regards §:O)


Jakob
 
Thanks again. I'll implement this in the next day or two and let you know how it worked out.




Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top