/    Sign up×
Community /Pin to ProfileBookmark

Single Value passed from pop up to mulitple form page

This is a shopping site I am making and what happens is the client chooses a style for the product they want to get. I have a standard page (the pop up) that they choose the style from then that value comes back to the parent page and then they add the item to there cart. Now I want to get this value taken from the pop up back to the proper form. I am very limited by the Web Host in what code I can use.
Also is there anyway to keep the parent page from refreshing to the top of the page? Any help is appreciated.

Thanks

Pop up windows code
Code:

[CODE]
<head>
<script language=”JavaScript” type=”text/javascript”>
function closeme(){
window.opener = null;
window.close();
}
</script>
</head>
<body>
<script language=”JavaScript”>
function getresult(){
for(i=0; i<26; i++)
{
if(document.forms[0].elements[i].checked)
{
var the_value = document.forms[0].elements[i].value;
}
}
self.opener.mainform.os0.value=the_value;
self.opener.mainform1.os0.value=the_value;
self.opener.mainform2.os0.value=the_value;
self.opener.mainform3.os0.value=the_value;
self.opener.mainform4.os0.value=the_value;
self.opener.mainform5.os0.value=the_value;
self.opener.mainform6.os0.value=the_value;
self.opener.mainform7.os0.value=the_value;
self.opener.mainform8.os0.value=the_value;
self.opener.mainform9.os0.value=the_value;
}
</script>
</head>

………………………..

<form>
blah blah blah

<input type=”button” name=”select” value=”Select” onclick=getresult()>
<input type=”button” name=”close” value=”Close” onclick=closeme()>

</form>
</body>
</html>
[/CODE]

Parent Code Snippet
Code:

[CODE]
<div class=”container”>
<div align=”left”> <img src=”../items/princess_maiden_plate.jpg” width=”280″ height=”280″ alt=”” class=”welcome” align=”left”/> </div>
<div class=”iteminfo”>
<p class=”itemname”>Size:&nbsp;<span class=”itemname1″>7 1/2″ Plate</span></p>
<p class=”features”> </p>
<ul>
<li></li>
</ul>
</p>
<p class=”price”>Price:&nbsp;<span class=”sale”>$15.00</span></p>
<form>
<input type=”image” src=”../images/style.gif” name=”style” onclick=”windowopener()” border=”0″ width=”120″ height=”23″ />
</form>
<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post” name=”mainform” target=”paypal” id=”mainform”>
<input type=”hidden” name=”cmd” value=”_cart” />
<input type=”hidden” name=”business” value=”email addy” />
<input type=”hidden” name=”item_name” value=”7 1/2 Inch Plate” />
<input type=”hidden” name=”amount” value=”15.00″ />
<input type=”hidden” name=”currency_code” value=”CAD” />
<input type=”hidden” name=”lc” value=”CA” />
<input type=”hidden” name=”on0″ value=”Pattern” />
<input type=”hidden” name=”os0″ />
<input type=”image” src=”https://www.paypal.com/en_US/i/btn/x-click-but22.gif” border=”0″ name=”submit” alt=”” width=”87″ height=”23″ />
<input type=”hidden” name=”add” value=”1″ />
</form>

</div>
</div>
<br />
<div class=”container”>
<div align=”left”> <img src=”../items/native_couple_plate.jpg” width=”280″ height=”280″ alt=”” class=”welcome” align=”left”/> </div>
<div class=”iteminfo”>
<p class=”itemname”>Size:&nbsp;<span class=”itemname1″>10 1/2″ Plate</span></p>
<p class=”features”> </p>
<ul>
<li></li>
<li></li>
</ul>
</p>
<p class=”price”>Price:&nbsp;<span class=”sale”>$25.00</span></p>
<form>
<input type=”image” src=”../images/style.gif” name=”style” onclick=”windowopener()” border=”0″ width=”120″ height=”23″ />
</form>
<form action=”https://www.paypal.com/cgi-bin/webscr” method=”post” name=”mainform1″ target=”paypal” id=”mainform1″>
<input type=”hidden” name=”cmd” value=”_cart” />
<input type=”hidden” name=”business” value=”email addy” />
<input type=”hidden” name=”item_name” value=”10 1/2 Inch Plate” />
<input type=”hidden” name=”amount” value=”25.00″ />
<input type=”hidden” name=”currency_code” value=”CAD” />
<input type=”hidden” name=”lc” value=”CA” />
<input type=”hidden” name=”on0″ value=”Pattern” />
<input type=”hidden” name=”os0″ />
<input type=”image” src=”https://www.paypal.com/en_US/i/btn/x-click-but22.gif” border=”0″ name=”submit” alt=”” width=”87″ height=”23″ />
<input type=”hidden” name=”add” value=”1″ />
</form>
</div>

[/CODE]

Again thank you,

Midknight

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@violent_jApr 27.2004 — hmm .. i understand from your story that a user selects a value from the popup, than that value needs to be put in a form in the 'opener' of the popup

but when i look at your code, i see that is already happening! maybe you have some kind of error code?

and what do you mean with [b]Also is there anyway to keep the parent page from refreshing to the top of the page?[/b] ??

grtz
Copy linkTweet thisAlerts:
@Midknight4authorApr 27.2004 — What I mean by that refreshing business. I mean that when the user presses the Choose Style button the parent page refreshes to the top of the page. I know how to anchor a link with a normal [CODE] <a href="#whatever" onclick="javascript:location='current.html';window.open('nextpage.html','winTitle','height=h','width=w',chrome=yes)">Click here</a>
[/CODE]

I want to know how I can incorporate this type of function into my form.
Copy linkTweet thisAlerts:
@Midknight4authorApr 27.2004 — Whoops forgot to show whats on the parent page for script.

[CODE]
<script language="JavaScript" type="text/javascript">
function windowopener(){
controlWindow=window.open("stylepage.html","","width=840,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,");
if (!controlWindow.opener) controlWindow.opener = self;
}
</script>
[/CODE]
Copy linkTweet thisAlerts:
@Midknight4authorApr 27.2004 — Defiantly a Mozilla/Netscape/Firefox javascript misconception. Opera and IE work alright. I just can't get the M/N/F browsers to keep the value.
×

Success!

Help @Midknight4 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...