Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Sep 2003
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Submitting information from a list of listboxes

    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
    Attached Files Attached Files

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    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?

  • #3
    New Coder
    Join Date
    Sep 2003
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Regular Coder
    Join Date
    Jun 2003
    Posts
    183
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    New Coder
    Join Date
    Sep 2003
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay? THat really didn't help, because in the explanation they didn't even print it out to a different page.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    The Planet Earth Code Poet: True
    Posts
    282
    Thanks
    0
    Thanked 1 Time in 1 Post
    Perhaps something like this will help you:

    Code:
    <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>
    Last edited by JohnKrutsch; 10-06-2003 at 07:32 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •