michellerobbins56
Programmer
Hi
I have created an ASP page which outputs data from a database displaying contents of a basket. This all works fine. One of the fields that is displayed is the 'quote basket name' which I have displayed in an input text field to allow a user to edit it. Next to each record that is displayed I have put a tickbox that the user must select meaning they want to edit just that record, they then edit the basket name text input field right next to the checkbox. I can return the 'value' of the check box selected which returns the basket id - this works. I have created an array to hold all the text input field values. I now need some way of getting the index or order of the checkbox selected and then linking it to the appropriate index in the array so as to know this is the correct basket name to update. I am having a problem finding out how to get the 'order' or index of the checkbox selected. I can return the value of the checkbox as already mentioned. Please can someone help me with this problem. Thank you very much for any help.
Here is the code that should be run when a user clicks an update 'button' (the input text field and checkbox field is at the bottom of the code):
'-------------------------------
'get the basket name that user has entered and put into array
formbasketname = Request.Form("sel_quotename")
formarray = Split(formbasketname,", ")
for j=0 to Ubound(formarray)
Response.Write "<br>" & formarray(j) 'TEST display contents of array - (this all works)
next 'move to next element in array
Set rsBasket = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM tvQuoteBasket_GetBasket WHERE user_id = " & userid
rsBasket.Open strSQL, cnnConn, 1, 4
rsBasket.MoveFirst
do
'get the checkbox value selected by the user - this holds the basketid value - (this works)
chkboxvalue = Request.Form("chkbox")(i)
'******NOW NEED TO GET THE BASKET NAME ENTERED BY USER THAT IS ASSOCIATED WITH THE CHECKBOX SELECTED
'******THEREFORE NEED SOME WAY TO GET THE 'ORDER' OF THE CHECKBOXES SELECTED. CURRENTLY 'i' JUST SHOWS THE TOTAL NUMBER OF CHECKBOXES SELECTED
'UPDATE DATABASE CODE GOES HERE (THIS IS NO PROBLEM) BUT NEED CORRECT VALUE OF BASKET NAME TO UPDATE WITH!
rsBasket.MoveNext
i = i + 1
loop until i = (Request.Form("chkbox").Count)
rsBasket.Close
'Code showing the checkbox filed and basket name input field - (this all works)
<INPUT type='checkbox' value='<%= basketid %>' name='chkbox'>
<input type="text" name="sel_quotename" value="<%=quotebasketname%>" maxlength="50" size="50">
'-------------------------------
Thank you for any help.
I have created an ASP page which outputs data from a database displaying contents of a basket. This all works fine. One of the fields that is displayed is the 'quote basket name' which I have displayed in an input text field to allow a user to edit it. Next to each record that is displayed I have put a tickbox that the user must select meaning they want to edit just that record, they then edit the basket name text input field right next to the checkbox. I can return the 'value' of the check box selected which returns the basket id - this works. I have created an array to hold all the text input field values. I now need some way of getting the index or order of the checkbox selected and then linking it to the appropriate index in the array so as to know this is the correct basket name to update. I am having a problem finding out how to get the 'order' or index of the checkbox selected. I can return the value of the checkbox as already mentioned. Please can someone help me with this problem. Thank you very much for any help.
Here is the code that should be run when a user clicks an update 'button' (the input text field and checkbox field is at the bottom of the code):
'-------------------------------
'get the basket name that user has entered and put into array
formbasketname = Request.Form("sel_quotename")
formarray = Split(formbasketname,", ")
for j=0 to Ubound(formarray)
Response.Write "<br>" & formarray(j) 'TEST display contents of array - (this all works)
next 'move to next element in array
Set rsBasket = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM tvQuoteBasket_GetBasket WHERE user_id = " & userid
rsBasket.Open strSQL, cnnConn, 1, 4
rsBasket.MoveFirst
do
'get the checkbox value selected by the user - this holds the basketid value - (this works)
chkboxvalue = Request.Form("chkbox")(i)
'******NOW NEED TO GET THE BASKET NAME ENTERED BY USER THAT IS ASSOCIATED WITH THE CHECKBOX SELECTED
'******THEREFORE NEED SOME WAY TO GET THE 'ORDER' OF THE CHECKBOXES SELECTED. CURRENTLY 'i' JUST SHOWS THE TOTAL NUMBER OF CHECKBOXES SELECTED
'UPDATE DATABASE CODE GOES HERE (THIS IS NO PROBLEM) BUT NEED CORRECT VALUE OF BASKET NAME TO UPDATE WITH!
rsBasket.MoveNext
i = i + 1
loop until i = (Request.Form("chkbox").Count)
rsBasket.Close
'Code showing the checkbox filed and basket name input field - (this all works)
<INPUT type='checkbox' value='<%= basketid %>' name='chkbox'>
<input type="text" name="sel_quotename" value="<%=quotebasketname%>" maxlength="50" size="50">
'-------------------------------
Thank you for any help.