Re: FormBuilder - automatic head-details forms generation

From: Date: Thu, 22 Feb 2007 19:20:25 +0000
Subject: Re: FormBuilder - automatic head-details forms generation
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-26646@lists.php.net to get a copy of this message
On 2/22/07, Gian Luca Ziosi <gianlucaziosi@tiscali.it> wrote:
[ENG] Hi to all in the FormBuilder documentation I have read of the several modalities of management of the linked records (crossLinks, reverseLinks, tripleLinks), but I have not found information for the automatic form generation of type head-detail, as an example orders-orders_rows. reverseLinks show ALL records of the table details, not only those linked.. Someone can give indications to me? Thanks. :(sorry for English)
I think what you mean here is that you want reverseLinks to show only those records that are actually linked to the current record. This is possible with prepareLinkedDataObject. http://pear.reversefold.com/dokuwiki/doku.php?id=pear:db_dataobject_formbuilder:callback_methods#preparelinkeddataobject_linkeddataobject_field You probably want something like this: <?php class DataObject_Orders extends DB_DataObject { //auto-generated stuff function prepareLinkedDataObject(&$linkedDataObject, $field) { if ($field == '__reverseLink_orders_rows_id_order') {
     $linkedDataObject->id_order = $this->id;
} } } ?> However, you should be careful here as unchecking the checkbox and submitting will only *unlink* the orders_rows record, not delete it. (Assuming that the id_order field is NULLABLE.) If the id_order field is NOT NULL then unchecking the checkbox will do nothing. I would suggest making the field NOT NULL and processing unchecking in your own code before FB processes its changes.
[ITA] Salve a tutti nella documentazione di FormBuilder ho letto delle varie modalità di gestione dei record linkati (crossLinks, reverseLinks, tripleLinks), ma non ho trovato informazioni per la generazione automatica di form di tipo testata-dettaglio, per esempio ordini-righe_ordine. reverseLinks visualizza TUTTI i record della tabella dettagli, non solo quelli correlati. Certamente mi sfugge qualcosa. Qualcuno mi può dare indicazioni? Grazie. Gian Luca Ziosi. /************** begin file: database.ini **************/ [orders] id_order = 129 customer = 130 [orders__keys] id_order = N [orders_rows] id_order_row = 129 qty = 129 id_order = 129 [orders_rows__keys] id_order_row = N /************** begin file: database.links.ini **************/ [orders_rows] id_order = orders:id_order -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Justin Patrin

« previous php.pear.general (#26646) next »