I am trying to use the SimpleFormIterator
in the React-Admin module to create a list of children records from the parent record edit form.
So I’ve setup a SimpleFormIterator
component with the details of the child record, however, this doesn’t return back an ID, so when I submit the form no ID for the child is maintained. This can be seen below:
<SimpleFormIterator>
{/* Want a hidden ID field here */}
<SelectInput label="Type" source="type" choices={ ... } />
<SelectInput label="Reason" source="reason" choices={ ... } />
<DateInput label="Date" source="date" />
</SimpleFormIterator>
General HTML code would suggest I need a hidden input to store the ID, however, I can’t work out a way to do this using React-Admin.
I’ve tried adding a TextInput
component into the SimpleFormIterator
, such as:
<TextInput source="id" hidden />
But the input is not hidden for some reason, it is shown to the client.
I’ve also thought to use the key
property of the SimpleFormIterator
but I don’t know how to access the current list of elements to directly access the ID value.
What am I missing, why is the field showing, or is there another way to maintain the ID against that child record?
2
Answers
I do not understand perfectly what you want to do.
But you can hide your TextInput the following way:
to create a hidden field in react-native you can use the folloing code.