Know which checkbox in a cycle have been selected?

0

My question is how can I know which checkboxes have been selected to update the text type input that contains that checkbox?

looks like this:

the table and the checkbox is inside a loop which prints as many tables as the sql query has

this is what I have in code

<%do while not siresic.EOF inc= inc +1 %>

my text type inputs are within this cycle in this way, I put the value of the increment to identify them each

<td style="background-color:#FFFFFF" width="10%"><input onpaste="return false" name="Tipo_acta<%Response.Write (inc)%>" type="text" SIZE="5" height=50 id="Tipo_acta<%Response.Write (inc)%>" value="<%Response.Write siresic.Fields("Tipo_acta").Value%>" style="background-color:#FFFFFF"> </td>

and my checkbox is this way

<td style="background-color:#FFFFFF" width="10%" rowspan="3"><input type="checkbox" name="actualizar" value="act<%Response.Write (inc)%>"> </td>

This is what happened to me to identify each one but now I do not know how the user selected the checkbox to update the inputs. It is worth mentioning that the one and two that you see in my table is also with the increase.

PS: I would greatly appreciate any example, even if it is not with asp, I just want to know how I could do it in this case.

    
asked by mrkillmer 19.07.2018 в 20:12
source

1 answer

0

the functionality of your table is that you first modify some of the inputs, select the checkbox to indicate which one is going to be modified and then press the update button?.

If so, I suppose that in the cycle that you bring from your DB, to fill that table, you assign the idendity of each field to either the checkbox or the tr as such.

What you could do is that in the click event of the checkbox (in case the identity is inside it), assign that identity to some variable and then send it in the update and select only that field from the database.

With Jquery he would do something like this:

$('.table tbody').on('click','#update-btn', function(event){
        var identity = 0;
        identity = $(this).val();  
});  

The identity value is passed as a parameter in the Update.

I hope and serve you my humble opinion, and I hope I have understood you.

Greetings.

    
answered by 03.08.2018 в 01:23