Closed vdupre closed 8 years ago
Hi,
the template
option can be used at arbitrary level of nesting
function personTemplate(locals) {
return (
<div>
<fieldset>
{ locals.inputs.name }
</fieldset>
<fieldset>
{ locals.inputs.stat }
</fieldset>
</div>
)
}
function statTemplate(locals) {
return (
<div className="row">
<div className="col-xs-6" >{ locals.inputs.defaultValue }</div>
<div className="col-xs-6" >{ locals.inputs.bonus }</div>
</div>
)
}
const options = {
template: personTemplate, // customise form Person
fields: {
stat: {
template: statTemplate // customise subform Stat
}
}
}
Ok, the solution was.. obvious.. sorry for this stupid question and thanks for the quick answer :)
No problem ;)
Hello,
I need to create an simple form for a model (Person) which has a "sub model" (Stat). So I write this :
and I create a custom template as describe in your doc. It's working for the Person model, but I can't find how to custom the Stat model. If I just type
it displays my stat model fields with the default template,
but I would like to access the sub fields, to do something like :
Any idea ? thanks by advance !!!