Jason Knight
1 min readApr 12, 2023

--

Very interested to see your article, as what you've said raised a lot of warning flags... if it's got controls isn't that tabular data not a list? Why would you have radio buttons involved at all, wouldn't that be a normal button to scripting off do a page load and scripting on send the delete via XMLHttpRequest or fetch? Why would you have multiple forms when you could just embed the id to edit or delete into the button's value?

And if you're building an app and as such don't care about scripting off degradation, just have buttons and requests with everything embedded via the parent accessed in the event by parentNode or Element.closest() or some other DOM walking or data- storage.

I mean if it's just an app, button... when clicked sends to the server "I'm trying to delete that", when the server acks deletion go to the button (event.currentTarget of the click event) and do button.closest("li").remove();

Maybe toss an animation in there to tell the user deletion is pending. If an app you're done. If a normal website and scripting off matters, let the button submit the form wrapping the entire list with <button name="delete" value="idNumber">

Not rocket science.

Though since you had the shit-show that is django on the back end, no wonder you were struggling.

--

--

Jason Knight
Jason Knight

Written by Jason Knight

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse

Responses (1)