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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2003
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    values in a listbox

    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>
    Last edited by adedoys; 01-07-2004 at 03:43 PM.

  • #2
    Regular Coder
    Join Date
    May 2002
    Location
    Virginia, USA
    Posts
    621
    Thanks
    0
    Thanked 6 Times in 6 Posts
    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"


  •  

    Posting Permissions

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