PDA

View Full Version : IE Form Refresh Problems


gvancott
10-26-2002, 01:37 AM
Still working on my shopping cart application.

The order page has a form for the customer to enter data and also displays the order (done with javascript with embedded html).

In the course of entering data the user can change the default shipping method or choose to add insurance. If these change, the page is reloaded using history.go(0) and the new total charges are recalculated and displayed. (This is currently in a refresh button near the bottom of the page although I had intended to put it in an onClick() action in the radio buttons.) This works perfectly in Netscape 4.79 and a recent download of Mozilla.

However IE6 does not preserve the form values the way the other browsers do, so the page is reloaded in its initial state.

Are there any easy work arounds for this problem?

You can look at it at:

https://secure.donax-us.com/www.vcisinc.com/sc.html

It is the page you get to after you click "Check Out"

Thanks for any help. Gary

whammy
10-27-2002, 03:02 AM
Well, since the problem is with reloading the page, perhaps you could pass the info to the same page in a querystring with javascript, and then process it when the "new" page is loaded.

I modified some script I found to make it simpler so you could use a QueryString() function like in ASP, but in javascript:


<script type="text/javascript">
<!--
function QueryString(str){
var q = window.location.search;
var foundValue = ""
if(q.length > 1){
this.q = q.substring(1, q.length);
}
this.keyValuePairs = new Array();
if(q){
for(var i = 0; i < this.q.split("&").length; i++){
this.keyValuePairs[i] = this.q.split("&")[i];
if(this.keyValuePairs[i].split("=")[0] == str){
foundValue = unescape(this.keyValuePairs[i].split("=")[1]);
}
}
}
return foundValue;
}
//-->
</script>

<script type="text/javascript">
<!--
document.write("<img src=\"" + QueryString('pic') + "\" width=\"" + QueryString('width') + "\" height=\"" + QueryString('height') + "\" />");
//-->
</script>


This isn't exactly set up to work with your code (which FYI works great in the browser I looked at it in, IE 5.5), but since it's simple to get the variable from the querystring this way, it might help. Here's a working example:

http://www.solidscripts.com/querystring.htm?pic=mypicture.jpg&width=214&height=118

Perhaps that might solve the problem... :)