我有一个非常简单的表格
span data-controller='reassignment'
= simple_form_for some_model, remote: true, html: {'data-target': 'reassignment.form'} do |f|
= f.association :user,
collection: User.all,
label: false,
include_blank: 'Unassigned',
input_html: { \
"data-target": "reassignment.user", \
"data-action": "change->reassignment#submitForm" \
}
现在我的刺激看起来像
import { Controller } from 'stimulus'
export default class extends Controller {
static targets = ['user', 'form']
submitForm(){
this.formTarget.submit()
}
onPostSuccess(event) {
console.log("success!")
}
}
表单提交但它不尊重remote: true
.