Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java Open Source > Struts
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Struts section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Reply
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old June 8th, 2007, 07:30 AM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

I want to store in the index from the iframe's iframe is to retrieve it in a popup window.
So here's what I have so far:
Code:
function createorder(){
    clickable=document.forms[0].check
    txt=""
for (i=0;i<clickable.length;++ i){
    if (clickable[i].checked){
        txt=txt + clickable[i].value + " "
        }
    }
document.getElementById("order").value="You ordered: " + txt
}    

function storeValue(what) {
    var oreilly = new Array(); //to hold the answer from the user    

    oreilly[0] = parent.parent.document.getElementById("gal1").value;/*parent.parent.document.getElementById("gal1").value;*/ //copies the user buyer to index.html hidden field  
    oreilly[1] = parent.parent.document.getElementById("gal2").value; //copies the user buyer to index.html hidden field  
    oreilly[2] = parent.parent.document.getElementById("gal3").value; //copies the user buyer to index.html hidden field  
    oreilly[3] = parent.parent.document.getElementById("gal4").value; //copies the user buyer to index.html hidden field          
    oreilly[4] = parent.parent.document.getElementById("gal5").value; //copies the user buyer to index.html hidden field 

    if(what.checked = true) {
        for(var i=0; i<oreilly.length; i++){
            oreilly[i].value = what.value;
        }
    }
}

function openpopup(){
    var oreilly = new Array(); //to hold the answer from the user    

    oreilly[0] = parent.parent.document.getElementById("gal1").value;/*parent.parent.document.getElementById("gal1").value;*/ //copies the user buyer to index.html hidden field  
    oreilly[1] = parent.parent.document.getElementById("gal2").value; //copies the user buyer to index.html hidden field  
    oreilly[2] = parent.parent.document.getElementById("gal3").value; //copies the user buyer to index.html hidden field  
    oreilly[3] = parent.parent.document.getElementById("gal4").value; //copies the user buyer to index.html hidden field          
    oreilly[4] = parent.parent.document.getElementById("gal5").value; //copies the user buyer to index.html hidden field     
    var newwindow1 = window.open("../orderform.html", "polar_bear", "width=450, height=420");    
    var tmp = newwindow1.document;
    for(var i=0; i<oreilly.length; i++){
        tmp.write(oreilly[i]);
    }
}
[red][b]createorder(); is used in the button as an onclick an is to test the checkboxes in the same page.
storeValue(what); is storing to the index page (parent.parent.).

I have a popup page in the same directory of the index and I want to write in the popup whatever is stored in the hidden fields.

Reply With Quote
  #12 (permalink)  
Old June 8th, 2007, 07:59 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,
use the onload attribute of the body tag in the pop up page and call a script method. In that method try using the following code

Code:
var hidden_field = opener.document.getElementById('order');
document.write(hidden_field.value);
Regards,
Rakesh
Reply With Quote
  #13 (permalink)  
Old June 8th, 2007, 09:19 AM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

so if I insert the onload in the body of the popup it's going to call the function from the js file right?

I'm having a hard time understanding how the hidden fields work. My form of checkboxes are in the iframes. The index page is the parent.parent. of the iframe. The hidden fields are in the index. And the popup page is in the root directory.
Reply With Quote
  #14 (permalink)  
Old June 11th, 2007, 08:11 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

Quote:
quote:Originally posted by gilgalbiblewheel
 so if I insert the onload in the body of the popup it's going to call the function from the js file right?

I'm having a hard time understanding how the hidden fields work. My form of checkboxes are in the iframes. The index page is the parent.parent. of the iframe. The hidden fields are in the index. And the popup page is in the root directory.
Java script wont fall if the pages are in some other direcotry or somewhere else,it'll keep track of the parent who opened the popup so you dont have to worry about it. Can you just post the file names and how the popup page gets opened? please mention which page holds the hidden fields and which popup need to access that value!
Then i'll try to write sample script which you can implement according to your requirements.

Regards,
Rakesh
Reply With Quote
  #15 (permalink)  
Old June 11th, 2007, 03:42 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

Ok here is the js file to which all the pages are linked to:
Code:
//JavaScript to be shared with program pages
var oreilly = new Array(); //to hold the answer from the user
function createOrder(){
    clickable=document.forms[0].check
    txt=""
for (i=0;i<clickable.length;++ i){
    if (clickable[i].checked){
        txt=txt + clickable[i].value + " "
        }
    }
document.getElementById("order").value="You ordered: " + txt
}    

function openpopup(){
    oreilly[0] = parent.parent.document.getElementById("gal1").value; //copies the user buyer to index.html hidden field  
    oreilly[1] = parent.parent.document.getElementById("gal2").value; //copies the user buyer to index.html hidden field  
    oreilly[2] = parent.parent.document.getElementById("gal3").value; //copies the user buyer to index.html hidden field  
    oreilly[3] = parent.parent.document.getElementById("gal4").value; //copies the user buyer to index.html hidden field          
    oreilly[4] = parent.parent.document.getElementById("gal5").value; //copies the user buyer to index.html hidden field 


    var newwindow1 = window.open("../orderform.html", "polar_bear", "width=350, height=320");
    var tmp = newwindow1.document;
    tmp.write("You Ordered: ");



function photos_bought(clickable, bought){
    oreilly[0] = bought;
    parent.parent.document.getElementById("gal1").value = bought; //copies the user buyer to index.html hidden field , so that the score_quiz()  can retrieve it.
    }
}
The hidden field form in the index.html
Code:
<div id="hidform">
        <form name="store" id="store">
            <input type="hidden" id="gal1" />
            <input type="hidden" id="gal2" />
            <input type="hidden" id="gal3" />
            <input type="hidden" id="gal4" />
            <input type="hidden" id="gal5" />
        </form>
</div>
popup:
Code:
<!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>
        <title>Order Form</title>
        <meta name="Generator" content="TextPad 4.6" />
        <meta name="Author" content="?" />
        <meta name="Keywords" content="?" />
        <meta name="Description" content="?" />
        <script type="text/JavaScript" language="JavaScript1.3" src="oreilly.js">
        function createOrder(){
            clickable=document.forms[0].clickable
            txt=""
        for (i=0;i<clickable.length;++ i){
            if (clickable[i].checked){
                txt=txt + clickable[i].value + " "
                }
            }
        document.getElementById("poporder").value="You ordered: " + txt
        }
        </script>

    </head>

    <body>
        <h1>Order Form</h1>
        <form name="bear" id="bear">
            <span style="">
                <textarea name="poporder" id="poporder" cols="30" rows="6"></textarea><br />
                <input type="reset" value="Reset" /> <input type="button" onClick="createOrder();" value="Send order" />
            </span>


            <input type="button" name="quit" value="Click here to close this window" onClick="self.close();" />

        </form>
    </body>
</html>
iframe of the index.html:
Code:
<form name="frm" id="frm" action="../wait.html" method="post" >
<div id="set1" style="position:absolute; left:65px;top:146px;">

<span style="position:absolute; left: -63px; top:-55px;width:104px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 1 300dpi" />
300dpi $100<br />
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 1 600dpi"/>
600dpi $175 </span>

<span  style="position:absolute; left: 60px; top:-55px;width:104px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 2 300dpi"/>300dpi $100
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 2 600dpi"/>600dpi $175</span>

<span style="position:absolute; left: 180px; top: -55px;width:104px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 3 300dpi"/>300dpi $100<br />
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 3 600dpi"/>600dpi $175</span>

<span style="position:absolute; left: -63px; top:60px;width:104px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 4 300dpi"/>
300dpi $100<br />
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 4 600dpi"/>
600dpi $175</span>

<span style="position:absolute; left: 58px; top:60px;width:104px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 5 300dpi"/>300dpi $100<br />
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 5 600dpi"/>600dpi $175</span>

<span style="position:absolute; left: 180px; top:60px;width:104px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 7 300dpi" />300dpi $100<br />
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 7 600dpi" />600dpi $175</span>

<span style="position:absolute; left: -63px;  top:170px;width:104px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 8 300dpi" />300dpi $100<br />
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 8 600dpi" />600dpi $175</span>

<span style="position:absolute; left: 60px; top:170px; width: 111px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 9 300dpi" />300dpi $100<br />
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 9 600dpi" />600dpi $175</span>

<span style="position:absolute; top: 170px; left: 180px;width:104px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 10 300dpi" />300dpi $100<br />
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 10 600dpi" />600dpi $175</span>

<span style="position:absolute; left: 60px;  top:270px;width:104px;">
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 1 300dpi" />300dpi $100<br />
<input name="check" id="check"  type="checkbox" onClick="photos_bought(this.value);" value="Ireland: picture 1 600dpi" />600dpi $175</span>

<span style="position:absolute; left: 307px; top:150px;width:71px;">
<textarea name="order" id="order" cols="50" rows="5"></textarea><br />
<input type="button" onClick="createOrder();openpopup();" value="Send order" /><input type="reset" value="Reset" /> 
</span>
</div>

</form>
Reply With Quote
  #16 (permalink)  
Old June 14th, 2007, 07:20 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi,

Its confusing. Just mention the flow [with file names] and where you've check boxes and where you are storing the formatted text and from where you are opening the popup? Thats it.

Sorry if i hurt you but i can't go through the code.

Regards,
Rakesh
Reply With Quote
  #17 (permalink)  
Old June 14th, 2007, 08:17 AM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

no problem. I'm not hurt. But is there a way to show in jpg files to post it in the forum? Maybe I can give the structure on jpg.

Reply With Quote
  #18 (permalink)  
Old June 14th, 2007, 08:27 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think attachments are not possible. you can upload it to any other place and provide the url.

Regards,
Rakesh

- Rakesh
Reply With Quote
  #19 (permalink)  
Old June 14th, 2007, 08:29 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:Originally posted by gilgalbiblewheel
 no problem. I'm not hurt. But is there a way to show in jpg files to post it in the forum? Maybe I can give the structure on jpg.

You can email it to me at any of these email ids iamrakesh22@gmail.com, iamrakesh22@hotmail.com, and iamrakesh22@yahoo.com

Regards,
Rakesh
Reply With Quote
  #20 (permalink)  
Old June 14th, 2007, 02:49 PM
Friend of Wrox
Points: 1,107, Level: 13
Points: 1,107, Level: 13 Points: 1,107, Level: 13 Points: 1,107, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2004
Location: , , .
Posts: 240
Thanks: 0
Thanked 1 Time in 1 Post
Default

ok thanks

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to store 2 checkbox values in separate lines i jennypretty Classic ASP Basics 1 June 3rd, 2007 06:39 PM
multiple checkbox store one field mateenmohd Classic ASP Basics 0 June 11th, 2006 01:39 AM
Store Checkbox values in MySQL Database jkilgore Beginning PHP 1 July 7th, 2005 03:43 PM
store machine name in database alyeng2000 ASP.NET 1.0 and 1.1 Professional 5 September 29th, 2004 10:55 PM
Where could get the Music Store Database? cash Java Databases 2 February 21st, 2004 08:48 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.