pass values of a dynamically created form

I have a list of emails that have different values associated with them in a DB. I want to be able to edit and/or delete each one. I dynamically created a series of forms using javascript to represent each email with a button to edit or delete in each one (the server side processing is in java).

All the forms are the same except for the value (and the name is different too). Basically, I need to pass the unique value (the email address) (or get the form name from the form which is clicked). I thought only the information associated with the particular form button that was clicked would be sent, but it seems when I used request.getParameterNames() all the fields from all the forms were sent, and I have no way of knowing which form was actually clicked.

Is this approach wrong in the first place? Should I be using a dynamically created onclick event for that form button. And if that is so, how do I create it such that it is unique. I did try the latter as well but I had trouble with a couple of things there (the functions were being created all passing back the same email rather than unique ones). Or should I be using another method? Sorry if this seems elementary. I have had a look around to try and find the answer, but I’m just not sure what the best approach is (even before I try and figure out what I’m doing wrong).


Source: forms

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.