Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling checkbox values on separate page

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi guys,

i have another javascript question, don't know how easy or hard it is for you experts though..
ok here's the deal...
i have a form with 2 textboxes and a button which when clicked opens up another page with an array of checkboxes 1 to 86..
now the user has to select whichever one of the checkboxes he/she wants and close the window by clicking on a button at the top of the page...the second page also has 2 textboxes for the user to enter information..
now my question is that i can get the values of the textboxes from page 2 to transfer back to page 1 but how do i get the values of the checkboxes???

if still unclear, i'll write down the code for you guys...
i was using a for loop which loops thru the number of checkboxes and in the for loop, there is an if statement which checks whether the checkboxes have been checked...if that's true, then the values of the textboxes are sent from page 2 to page 1 and the checkbox numbers should be listed as a comma separated list...

thanks
arif
 

rifs,

Try the following code below.

Fengshui1998


<html>
<body>
<head>
<script language=&quot;javascript&quot;>
function doit() {
alert(&quot;Time Card: &quot; + document.rdo.report[0].checked)
alert(&quot;Time Summary: &quot; +document.rdo.report[1].checked)
}
</script>

</head>
<form name=&quot;rdo&quot;>

<br><INPUT TYPE=&quot;checkbox&quot; name=&quot;report&quot; value=&quot;timecard&quot; checked>Time Card
<br><INPUT TYPE=&quot;checkbox&quot; name=&quot;report&quot; value=&quot;summary&quot;>Time Summary
<br><INPUT TYPE=&quot;button&quot; name=&quot;test&quot; value=&quot;Test Me&quot; onclick=&quot;doit()&quot;></td>

</form>

</body>
</html>
 
thanks fengshui but that's not exactly what i was looking for...
ok page 1 has a button at the top which opens up page 2 with let's say an array of 10 checkboxes and 2 text fields outside the array...

page 1 also has 2 text fields but nothing is entered in them initially...

now on page 2, the user has to enter some strings into the 2 text fields and select let's say 5 checkboxes...after that, a button at the bottom of page 2 must be pressed to relay all that information back to page 1...

my question is that i can get the text field info back to page 1 but not the values of the checkboxes...
is it possible to call checkboxes on a different page?
i have an if statement which says

if (document.<i>formname</i>.checkboxes.checked) {
write out the value of the checkboxes separated by commas


is that right?
arif
 
Create a method on the 1st page that stores or sets the values you want (on the 1st page).

function setX(data)
{
//code to set or store &quot;data&quot;
}

Call that method on the second page, in the onClick event of the checkbox, passing whatever value you want.

onClick=&quot;javascript:top.opener.setX(&quot;value&quot;);&quot;


Of course you can do much more, this is just the basic methodology.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top