Javascript with form field name "list[]"

Discussion in 'OT Technology' started by whitestang, Aug 9, 2003.

  1. whitestang

    whitestang Guest

    I've got a page that uses a bit of javascript to add options to a multiple select box, which then sends to a php page. To store all the options in the box as an array, php requires the form name to end with [], but then the javascript gets confused and thinks the form name is an actual array. Is there some way to get javascript to deal with forms named "something[]"

    i.e: how do i make "alert(form.field[].value)" work?
  2. whitestang

    whitestang Guest


    nevermind. Adding <select name="list[]" id="idlist" multiple> and then using the id name works.

Share This Page