Results 1 to 2 of 2

Thread: how to identify mulitple select option from database

  1. #1

    Thread Starter
    Fanatic Member ZeBula8's Avatar
    Join Date
    Oct 2002
    Posts
    548

    how to identify mulitple select option from database

    i'm using this piece of code to test with - sorry, it aint' pretty:

    what I'm trying to do is identify each of the pieces of information.

    There could be many select objects with only 4 or 5 options, so how can i identify the object and its information.

    thanks in advance.

    Code:
    <html><head><title>Title</title></head>
    <body>
    
    
    
    <script language="Javascript">
    function doProductPick(i)
    {
    var si;
    var pvalue;
    var desc;
    var j;
    var k;
    
    	for (k=0;k<document.mock.mockup.length-1;k++)
    	{
    	   for (j=0;j<document.mock.mockup[i].options.length-1;j++)
    		{
    			si = document.mock.mockup[k].options[j].selectedIndex;
    			pvalue = document.mock.mockup[k].options[j].value;
    			desc = document.mock.mockup[k].options[j].text;
    			alert("selectedIndex: " + si + "  - value: " + pvalue + " - desc: " + desc);
    		}
    	}
    
    	//si =	document.mock.mockup[i].options[i].selectedindex;
    	//pvalue = document.mock.mockup[i].value;
    	//desc = document.mock.mockup[i].text;
    	//alert("selectedIndex: " + si + "  - value: " + pvalue + " - desc: " + desc);
    	//alert(i);
    
    }
    
    </script>
    
    
    
    
    <form name="mock" method="post">
    
    <% dim boolContinue
       dim counter
    	counter = 0
     	boolContinue = true %>
    
    
    
    <table border="1">
    	<% while boolContinue %>
    
    	<tr>
    		<td>
    			<select  name="mockup" onchange="doProductPick(<% =counter %>)">
    			    
    				<option></option>
    				<option value="pink">Pink
    				<option value="red">Red
    				<option value="white">Blue
    				<option value="green">Green
    				
    			</select>
    		</td>
    
    	</tr>
    		
    
    	<% counter = counter + 1
    	   if counter = 20 then boolContinue = false %>
    	<% wend %>
    
    </table>
    
    
    
    <input type="submit" value="go">
    
    </form>
    
    </body>
    </html>
    Last edited by ZeBula8; Jul 12th, 2006 at 10:35 PM.

  2. #2

    Thread Starter
    Fanatic Member ZeBula8's Avatar
    Join Date
    Oct 2002
    Posts
    548

    Re: how to identify mulitple select option from database

    I believe I've figured it out - see code in function below:

    Code:
    <html><head><title>Title</title></head>
    <body>
    
    
    
    <script language="Javascript">
    function doProductPick(i)
    {
    
    	var si = document.mock.mockup[i].options.selectedIndex;
    	var pvalue = document.mock.mockup[i].options[si].value;
    	var desc = document.mock.mockup[i].options[si].text;
    	alert("selectedIndex: " + si + "  - value: " + pvalue + " - desc: " + desc);
    
    }
    
    </script>
    
    
    
    
    <form name="mock" method="post">
    
    <% dim boolContinue
       dim counter
    	counter = 0
     	boolContinue = true %>
    
    
    
    <table border="1">
    	<% while boolContinue %>
    
    	<tr>
    		<td>
    			<select  name="mockup" onchange="doProductPick(<% =counter %>)">
    			    
    				<option></option>
    				<option value="pink">Pink
    				<option value="red">Red
    				<option value="white">Blue
    				<option value="green">Green
    				
    			</select>
    		</td>
    
    	</tr>
    		
    
    	<% counter = counter + 1
    	   if counter = 20 then boolContinue = false %>
    	<% wend %>
    
    </table>
    
    
    
    <input type="submit" value="go">
    
    </form>
    
    </body>
    </html>

Posting Permissions

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



Click Here to Expand Forum to Full Width