...

View Full Version : Submitting information from a list of listboxes



mab9981
10-06-2003, 02:47 PM
I have attached an html file.

What i'm trying to do is make it so that when you check the box you get the whole row of information so when you hit submit it puts all your SELECTED information on another page!


MICHAEL

homerUK
10-06-2003, 03:29 PM
not sure what you mean.... do you mean use JS to automatically show more information when you click the tick box? or simply when you click the check box, and press submit, it gets that rows information?

mab9981
10-06-2003, 03:37 PM
choice b.

I want it so i only get the the information from the check rows.

I don't need more boxes to appear :) SOrry for the confusion.

zuzupus
10-06-2003, 04:29 PM
on this line

<form name="form2" method="post" action="">
<input type="submit" name="Finished" value="Submit">
</form>

u have to redirect to another page and there u have to pass the field names or just have a look at

http://javascript.internet.com/forms/order-form.html

cheers

mab9981
10-06-2003, 05:38 PM
Okay? THat really didn't help, because in the explanation they didn't even print it out to a different page.

JohnKrutsch
10-06-2003, 08:08 PM
Perhaps something like this will help you:



<html>
<head>
<title></title>
<script>

function sendInfo(){
var frm=document.f1;
var obj=document.getElementById("info");
var str="";
for(var i=0; i<obj.rows.length; i++){
if(frm["checkbox"+i].checked){
for( var j=1; j<obj.rows[i].cells.length; j++){
str+=obj.rows[i].cells[j].innerHTML+"|";
}
str+="~~";
}
}
document.f0.data.value=str.substring(0,str.length-2);
document.f0.submit();
}
</script>
</head>
<body>
<form name="f0" method="get" action="next.htm">
<input type="hidden" name="data" value="" />
</form>

<form name="f1">

<table border="1" id="info">
<tr>
<td>
<input type="checkbox" name="checkbox0" />
</td>
<td>
Row 0, Column 1
</td>
<td>
Row 0, Column 2
</td>
<td>
Row 0, Column 3
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="checkbox1" />
</td>
<td>
Row 1, Column 1
</td>
<td>
Row 1, Column 2
</td>
<td>
Row 1, Column 3
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="checkbox2" />
</td>
<td>
Row 2, Column 1
</td>
<td>
Row 2, Column 2
</td>
<td>
Row 2, Column 3
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="checkbox3" />
</td>
<td>
Row 3, Column 1
</td>
<td>
Row 3, Column 2
</td>
<td>
Row 3, Column 3
</td>
</tr>
<tr>
<td>
<input type="checkbox" name="checkbox4" />
</td>
<td>
Row 4, Column 1
</td>
<td>
Row 4, Column 2
</td>
<td>
Row 4, Column 3
</td>
</tr>
</table>
<input type="button" value="Submit" onclick="sendInfo()">
</form>
</body>
</html>


then on next.htm have this:

<script>
if (document.location.search){
var i, ary = unescape(self.location.search.substr(6)).split("~~");
for (i in ary) {
ary[i] = ary[i].replace(/\+/g," ");
document.write(ary[i]+"<br />");
}
}
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum