Question : Problem passing child data to parent window

I've run into subtle problem passing data from a child window in an iframe to the main window,
involving forms. Another set of eyes at this point would be most welcome.

The init() function of Main.html, below, pushes a new sw1 structure (just a "type" and a "bread" entry) onto an "order" array and loads child.html into an iframe.  There's a showBread() function ,called by the "Show Bread" button, that pulls the top object off of the order array and displays the object's bread, or displays "order array is empty" if the array is empty.

The init() function of  child.html, farther below, pops the top object off of the parent's order array and waits for you to select the Submit button or the "Change Bread" button. Submit goes to the AddToOrder() function and "Change Bread" goes to the changeBread() function and each of these functions has identical code.

If you execute the changeBread() function  all goes as expected. The bread is changed, the item is put back on the parent order array and you can select "Show Bread" on the main page and see that the item is back on the order array and the bread has changed from the default White to Wheat.  But if you select the Submit button, the bread is changed but the push at the end puts the item somewhere besides the parent order array and when you select "Show Bread" it finds the order array empty. That is, the child init() pulled off the top entry and nothing was ever put back.

The form radio selections are not used at all. ( I just needed a form to recreate the problem.)  The form submission seems to select a completely  different  address space for the push.  

Does anyone know what might be going on here?

Thanks for any ideas.

Main:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
    iframe#childFrame 
    {
        display:none;
        width:320px;
        height:200px;
    }
</style>
<script language="javascript">
    var order = []; // order array
    var item;

	function sw1() {
	    this.type = "turkey";
	    this.bread = "White";
	}
	
	function showBread() {
	    if (order.length == 0) {
	        alert("order array is empty");
	    }
	    else {
	        item = order.pop();
	        alert('Main: bread is ' + item.bread);
	    }
	}

	function init() {
	    order.push(new sw1());
	    window.frames['childFrame'].location.href = 'child.html';
	    var obj = document.getElementById('childFrame');
	    obj.style.display = 'block';
	    
	}
	
</script>
</head>

<body onload="init()" >
    <input type="button" value="Show Bread" onclick="showBread()"/>
    <iframe name="childFrame" id="childFrame"></iframe>
</body>

</html>


child:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
    <style type="text/css">
</style>
<script language="javascript">
    var item;
    function init() {
        item = window.parent.order.pop();
    }
    function AddToOrder() {
        item.bread = 'Wheat';
        window.parent.order.push(item);
    }
    
    function changeBread() {
        item.bread = 'Wheat';
        window.parent.order.push(item);
    }
    
</script>
</head>
<body onload="init();">
    <form onsubmit="AddToOrder();">
              <input type="radio" name="BREAD" value="White" />White<br/>
              <input type="radio" name="BREAD" value="Wheat"/>Wheat<br/>
            <p ><input id="done" type="submit" value="Submit"  /></p>
   </form>

   <input type="button" value="Change Bread" onclick="changeBread()"/>
</body>
</html>

Answer : Problem passing child data to parent window

you need to use DISKPART to extend the volume

instructions - http://support.microsoft.com/kb/325590

if it's your boot volume though, you'll either have to boot using BartPE or add the disk to another Windows 2003 server and extend it on there.

Stating the obvious time - TAKE A FULL BACKUP BEFORE YOU DO ANYTHING AS YOU COULD LOSE ALL YOUR DATA
Random Solutions  
 
programming4us programming4us