ASP not recognizing dynamic values

Okay, I have 2 select boxes, one is populated by the other thru a commonly used javascript. That works without any problems. Now I need to insert the values from the newly populated select box into a sql tbl. this is where we run into a problem. It seems that ASP & SQL will not recognize the values from the dynamicly generated select list. Here is the code. There is a hidden field to trigger the if statement. The kicker is if I just use the single drop down (list1) to insert diredctly from there is no problems, so I know that it's a recognition problem.

<!--Insert Statement//-->
if Request.Form("action") = "pick" then

if(Request.Form("grpName") <> "") then courseGrpInsert__MMColParam1 = Request.Form("grpName")
if(Request.Form("grpIdentNumber") <> "") then grpIdentNumber = Request.Form("grpIdentNumber")

Dim arrCourse
arrCourse = Request.Form("list2")
arrCourse = Split(arrCourse,",")


For i = 0 to uBound(arrCourse)
'SQL Insert Command here

set courseGrpInsert = Server.CreateObject("ADODB.Command")
courseGrpInsert.ActiveConnection = MM_Employees_STRING
courseGrpInsert.CommandText = "INSERT INTO  trainingGroups (grpIdentNumber,grpName,course_id )  VALUES (" + "'" + trim(grpIdentNumber) + "'" + "," + "'" + trim(courseGrpInsert__MMColParam1) + "'" + "," + trim(arrCourse(i)) + ")"
courseGrpInsert.CommandType = 1
courseGrpInsert.CommandTimeout = 0
courseGrpInsert.Prepared = true
courseGrpInsert.Execute()


Next

end if

<!--End Insert//-->

<!--Code for the two select boxes//-->

      <tr>
            <td align="center" valign="middle">
                  <select class = "db" multiple size="10" name="list2" style="width:275">
                  </select>
            </td>
      </tr>
      <tr>
            <td align="center" valign="middle">
                  <input type="button" value="Add"
                   onclick="moveOptions(this.form.list1, this.form.list2);" />
                  <input type="button" value="Delete"
                   onclick="moveOptions(this.form.list2, this.form.list1);" />
            </td>
      </tr>
      <tr>
            <td align="center" valign="middle">
            Course List
            </td>
      </tr>
      <tr>
            <td align="center" valign="middle">
                  <select class = "db" multiple size="10" name="list1" style="width:275">

                    <%
                        While (NOT courseList.EOF)
                        %>
                    <option value="<%=(courseList.Fields.Item("course_id").Value)%>"><%=(courseList.Fields.Item("Course").Value)%></option>
                    <%
                          courseList.MoveNext()
                        Wend
                        If (courseList.CursorType > 0) Then
                          courseList.MoveFirst
                        Else
                          courseList.Requery
                        End If
                        %>
                  </select>
            </td>
      </tr>
<!--end select boxes//-->
NMCoderMikeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HuyBDCommented:
which is database you use, and how does this page work, It raise excception?
0
darkeryuCommented:
Hi:

you can collect the list item before user submit the form :

1.add a hidden field name list3
2.onsubmit action(javascript):
list3.value = '';
for(i=0;i<list1.length;i++)
{
  list3.value = list3.value + list1.option[i].value + ","  
}

3.change asp to
arrCourse = Request.Form("list3")
arrCourse = Split(arrCourse,",")

thanks

 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Anthony PerkinsCommented:
Please delete the following duplicate question, before someone contributes as it violates the 500 point maximum.
http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_21820297.html

Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.