...

View Full Version : values in a listbox



adedoys
01-07-2004, 02:12 PM
Hi there i was wandering if anybody could help me with this problem. I've created a list box that the user can enter values in using javascript. but i cant grab any of the informationed when the data is posted. Is it possible to grab all the information and if yes how can this be done. Thanks attached below is a snippet of my code: -

<select name="Attributes_chosen[]" multiple size="5">
<option>problem_number</option>
<option>crstatus</option>
</select>

<script>
var group=new Array()
group[0]=new Option("problem_number")
group[1]=new Option("crstatus")

var temp=document.forms[0].elements['Attributes_chosen[]']
//document.CreateQuery.Attributes_chosen



function change(){

var sel = document.CreateQuery.Attributes;
var opt = sel.options[sel.selectedIndex].text;


group[group.length]= new Option(opt);

for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group.length;i++){
temp.options[i]=new Option(group[i].text,group[i].value)
}
temp.options[0].selected=true
}

</script>

Celtboy
01-08-2004, 04:14 AM
one way, would be to add what they do to a variable, and store that variable as a value of hidden form element...like such:


<form...>
<input type="hidden" name="user_added">
...


<script....>
document.user_added.value += "text=" + group[i].text + "value=" + group[i].value
...

when it's submitted, php could access the value "user_added"



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum