Hi Roland,
While there is no silver bullet strategy for this currently, there are a number of ways that you can achieve this - and it will depend a little bit on what you mean by "send the data to dataface for processing".
Strategy 1: Create a dummy relationship and then display a new related record form.
Dataface has the ability to generate forms to add records to a relationship. A relationship is basically an SQL query that can span over multiple tables. If you don't want the relationship to appear in the related tabs for your table, you can set the action:visible property of the relationship to 0. E.g. in the relationships.ini
- Code: Select all
[customform_relationship]
__sql__ = select * from people ppl inner join publications pub on ppl.personid=publications.ownerid
action:visible = 0
To access a form to add new records to this relationship (it will contain all fields form people and publications tables), you would enter the url:
http://yourdomain.com/yourapp/index.php?-table=people&-action=new_related_record&-relationship=customform_relationship(This assumes that the relationships.ini file above was for the "people" table).
The limitation of this strategy is that you can only add new records with this form - you can't edit existing records.
Strategy 2: In MySQL 5, create a view with all of the fields you need in your form - and then just add new records to this view from dataface.
You have to make sure that all of the primary keys are included in the view - and the fields.ini file must tell dataface which fields are keys (because it can't pick it up for views) by adding:
Key = PRI
to all columns that should be part of the primary key.
Strategy 3: Create a dummy table with columns for each field you want on your form, and use the afterInsert(), afterSave(), or afterUpdate() triggers to update the target tables whenever this table is updated.
e.g.
- Code: Select all
function afterInsert(&$record){
$people_rec = new Dataface_Record('people', array());
$people_rec->setValues($record->getValues());
$people_rec->save();
$publications_rec = new Dataface_Record('publications', array());
$publications_rec->setValues($record->getValues());
$publications_rec->save();
}
There are probably other strategies but this should give you something to chew on.
Best regards
Steve