Forum Moderators: coopster

Message Too Old, No Replies

passing checkbox array value to popup window problem

         

Ruurd

4:03 pm on Jun 12, 2007 (gmt 0)

10+ Year Member



Hi,

I'm really stuck with this, tryed everything i knew. Im making a compare script for something.

I've got my checkbox, which show up at every product result:

<input type="checkbox" name="rsid[]" value="<?=$row4['ID'];?>" />

The important lines of my form:

<form name="printen" onsubmit="return false;" action="">
<INPUT type="image" name="but_vergelijk" src="images/rs_compare_btntop.gif" border="0" onclick="popItUp();">

The javascript part:


function popItUp(rsid) {
var w = window.open('vergelijk.php?rsid='+document.printen.elements['rsid[]'].value+'' , 'cat', 'toolbar=0,statusbar=0,location=0,menubar=0,scrollbars=1,width=800,height=700,left = 140,top = 152');
w.focus();
}

The popup shows correct, but on the spot where my rsid[] should come, it says "undefined". Can anyone help me with this? thank you..

joelgreen

4:28 pm on Jun 12, 2007 (gmt 0)

10+ Year Member



Maybe it does not like [] in variable name. I'm usually accessing strangely named variables using document.getElementById.

<input type="checkbox" id="rsid[<?php echo $count;?>]" name="rsid[]" value="<?=$row4['ID'];?>" />

in javascript
document.getElementById("rsid[1]").value

cameraman

5:50 pm on Jun 12, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You have your function defined as needing rsid as a parameter, but in your onclick call you're not supplying it.