I'm trying to render Multiple select2 with json form but I can't
$('#resource-form').jsonForm({
schema: {
rest: {
type: 'object',
properties: {
template_id: {
type: "array",
items: {
type: "string",
}
}
}
}
}
}
form: [
{
type: "select",
key: "rest.template_id[]"
}
]
}
$("select[name='rest.template_id[]']").select2({
data: data,
multiple: true
})
Select2 work very fine but if i submit form that backend get empty template_id param
{"rest"=>{"template_id"=>[]}}
I think I created incorrect schema and form. Can you help me?
Here is a hack that will work for you. This will get all of the select field and turn it to select2.
$("select").select2({
data: data,
multiple: true
})
But if you want something specific, look for the Select field id that jsonform profide and pass it on as so.
$("@root_something").select2({
data: data,
multiple: true
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.