Was wondering if we could retrive id from submit button. The problem is that i dont want it in the values. I have many attachments and with it next to it a delete button . I just want to “Delete” to read as “Delete” . So id was what i assumed would be the best way to hold the identifier for which attachment to delete. Its just that i cant find the code from Django that actually gets the id in views ?
deletevalue = self.request.POST.get (‘Delete’) # gets values , but i just want the id of the submit button pressed
The problem with that the values for multiple delete buttons are the same . I want the id of that submit button . I dont want to have it in values as it clutters the UI with Delete145, Delete146 etc .
I’m sorry, I’m a bit confused by what you’re trying to say here.
First you’re talking about buttons, but your example shows an a tag with a link. How does that relate to the rest of your post?
Aside from that, a button element submits the value attribute, not the id, nor the displayed value inside the button. You can create as many different buttons as you wish.
It’s the input element that submits the value without the option of identifying a separate display value.
Ok i guess the issue i want to get id values from post from an input type=submit button. Not using javascript. Seems like it cant be done or i am missing something again
You need to surround blocks of code with lines of three backtick - ` characters. (A line of ```, then your code, then another line of ```.) Or, if it’s just one line (or part of one line), you can use one backtick `, then the text, then another backtick - looks like this.
Ok thanks again, just have to use the javascript way i guess. The issue is i dont want delete buttons to have various labels on it
‘’’
{% for X in object_list %}