Keyvan Sabras said about 1 year ago on Gathering Questionnaire Responses :
 Hello David & everyone!
As a beginner on Rails, I've been following your tutorials so far to create my first survey.

Everything is going smoothly except for the nested-form controller, I can create questions & answers (multiple answers as well) but I can't delete a question or answer I've created.
I kept getting this error: 
Error invoking action "click->nested#remove_association" TypeError: t is null

Here is my nested-form controller : 
import { Controller } from "@hotwired/stimulus"
// Connects to data-controller="nested"
export default class extends Controller {  
static targets = ["add_item", "template"]  
static values = { index: String }

  add_association(event) {    
    event.preventDefault()
    var content = this.templateTarget.innerHTML.replace(new RegExp(this.indexValue, 'g'), new Date().valueOf())    
    this.add_itemTarget.insertAdjacentHTML('beforebegin', content)  }


  remove_association(event) {    
    event.preventDefault()    
    let item = event.target.closest(".nested-fields")    
    item.querySelector("input[body*='_destroy']").value = 1    
    item.style.display = 'none'  }}

I have just replaced the "name" by "body" in the remove_association, which is the name of my input in the questions & answers models.

If anyone has an idea how to correct this issue, or had this error it would be of great help!
Thanks a lot.