Simon Kiteley PRO said almost 5 years ago on Saving Individual Attributes with StimulusJS :
Don't know if it would be of any help to any one but I did this: ``` ``` and ``` switch_on(event) { let data = new FormData() // user[host_video] let that = this; data.append(this.off_switchTarget.name, '1') Rails.ajax({ type: 'PATCH', url: this.url(this.off_switchTarget), dataType: 'json', data: data, success: function (response) { var on = document.getElementById(that.element.getAttribute('id') + '-on'); var off = document.getElementById(that.element.getAttribute('id') + '-off'); on.style.display = 'inline'; off.style.display = 'none'; }, error: function (response) { console.log('Setting could not be saved.')} }) } switch_off(event) { let data = new FormData() let that = this; data.append(this.on_switchTarget.name, '0') Rails.ajax({ type: 'PATCH', url: this.url(this.on_switchTarget), dataType: 'json', data: data, success: function (response) { var on = document.getElementById(that.element.getAttribute('id') + '-on'); var off = document.getElementById(that.element.getAttribute('id') + '-off'); off.style.display = 'inline'; on.style.display = 'none'; }, error: function (response) { console.log('Setting could not be saved.')} }) } ``` Sure my javascript is pants and not my expertise but it works well.