Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

moving information from one web page to another

 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm doing a website in HTML and want to get information from one page to another. It's a mock e-commerce site I want to price to follow with the pages. I have the following which does not work. Note the alert works.
<script language="javascript" type="text/javascript">

function purchase(checkboxform)
{
var num = checkboxform.length;
for(var i = 0; i< num; i++)
{
if(checkboxform[i].checked)
{
alert("Brunelleschi's Dome is "+checkboxform[i].value);
document.write("cart.html.form1.Price.value = checkboxform[i].value");
}
}


}
</script>

--------------------------------------------------------------------------------
 
Pavan Keely
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Donna,

Are those HTML pages opened in the browser when you access this script ? If you have window reference to the other page, then you can use,

windowRef.form1.Price.value = checkboxform[i].value.

If you don;t have those pages open in the browser and the second page is the result of a form submission (or some other way) then you can use cookies/hidden HTML fields/server side sessions. Not sure what you are looking for.
 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a submission page I am taking a product to a shopping cart. If it's server side we are not supposed to mess with it. but I would like to know how anyway. Thanks
 
Pavan Keely
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are not supposed to mess with server side ? Anyways, you have to use session variables to do these.

If you didn't mean to mess up with server side, what was the specified script written for ? To set that value in one of the hidden varibles in the same page ?
 
Pavan Keely
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you don;t want to do that on server side, you can client side cookies for that.
 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you do that?
 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I got the idea of making a cookie from the w3c. I'll let you know if it works.
 
Pavan Keely
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Donna,

I found a resource for you.

http://www.echoecho.com/jscookies02.htm

In the first page, you set the cookie for the price or whatever that is and after the submission page comes back to the client, you can read the same cookie. Please see the functions text provided in that URL. Basically, you set and get the cookie using document. cookie.

I hope this helps.
 
Donna Bachner
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I got it working thanks for the help.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic