Example: I have Members (who can login and update their data) who have one or many qualifications. So I have a DataObject 'Members' and a DataObject 'Qualification' with a has_one/has_many relationship.
Something like this:
class Qualification extends DataObject {
private static $db = array (
'Title' => 'Text',
'From' => 'Date',
'Till' => 'Date'
);
private static $has_one = array (
'Member' => 'Member',
);
...
class Member extends DataObject {
...
private static $has_many = array (
'Qualifications' => 'Qualification',
);
...
Now I want to build a form in the frontend which allows the member to add many qualifications at once and also update existing qualifications in the same form.
It could look like this
Qualifikation One
Title: xxx (textfield) From: xxx (datefield) Till: xxx (datefield)
Qualifikation Two
Title: xxx (textfield) From: xxx (datefield) Till: xxx (datefield)
+ add qualifications
What is the best way to do that?
I could use jQuery to add fields dynamically like this: http://jsfiddle.net/nzYAW/
But how can I handle to update and add them to the database. Everything I tried was really complicated and messy, so I think maybe somebody else has an idea I just don't see at the moment. Every help would be appreciated!
GridField
on the front end with the GridField extensions moduleGridFieldEditableColumns
andGridFieldAddNewInlineButton
components. – Ejective