Re: FormBuilder Crosslinks Problem

From: Date: Tue, 22 Aug 2006 00:48:57 +0000
Subject: Re: FormBuilder Crosslinks Problem
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-24946@lists.php.net to get a copy of this message
On 8/21/06, led_belly <jacob-nospam@keystreams.com> wrote:
I am trying to setup a cross-linked select box based on the info presented below. For some reason FormBuilder isn't presenting the cross linked form element. I have the following DB tables/fields: [ga_merchants] merchantid ... [ga_categories] categoryid ... [ga_merchant_categories] merchantid categoryid My links.ini file is setup as follows: [ga_merchants] merchantid = ga_merchant_categories:merchantid
What's this for? You only set up links for fields which are linking *to* something else. merchantid is (I assume) the PK of ga_merchants.
[ga_merchant_categories] merchantid = ga_merchants:merchantid categoryid = ga_categories:categoryid
These look correct.
[ga_categories] categoryid = ga_deal_categories:categoryid categoryid = ga_merchant_categories:categoryid
This is certainly incorrect. A field can only link to one other table/field. You're doing your links backwards here...
I have the following set in the Ga_merchants class:
    var $fb_crossLinks = array(array('table' => 'ga_merchant_categories',
    'fromField' => 'merchantid',
    'toField' => 'categoryid',
You shouldn't need either of those, the fields will be found automatically.
    'type' => 'select'));
The debug output is as follows: Array ( [id] => 13 [op] => edit [process] => Go > ) ga_merchants: CONNECT: Checking for database database_ in options ga_merchants: CONNECT: NEW CONNECTION ga_merchants: CONNECT: mysql://gotapex:***@192.168.0.7/gotapex_vb354 78860d6931124e3a7c2d43153e076464 ga_merchants: CONNECT: a:1:{s:32:"78860d6931124e3a7c2d43153e076464";O:8:"db_mysql":8:{s:10:"autocommit";b:1;s:8:"dbsyntax";s:5:"mysql";s:3:"dsn";a:9:{s:7:"phptype";s:5:"mysql";s:8:"dbsyntax";s:5:"mysql";s:8:"username";s:7:"gotapex";s:8:"password";s:15:"SDFgn4iu38GEGre";s:8:"protocol";s:3:"tcp";s:8:"hostspec";s:11:"192.168.0.7";s:4:"port";b:0;s:6:"socket";b:0;s:8:"database";s:13:"gotapex_vb354";}s:8:"features";a:7:{s:5:"limit";s:5:"alter";s:8:"new_link";s:5:"4.2.0";s:7:"numrows";b:1;s:8:"pconnect";b:1;s:7:"prepare";b:0;s:3:"ssl";b:0;s:12:"transactions";b:1;}s:9:"fetchmode";i:1;s:22:"fetchmode_object_class";s:8:"stdClass";s:7:"options";a:8:{s:16:"result_buffering";i:500;s:10:"persistent";b:0;s:3:"ssl";b:0;s:5:"debug";i:0;s:14:"seqname_format";s:6:"%s_seq";s:8:"autofree";b:0;s:11:"portability";i:0;s:8:"optimize";s:11:"performance";}s:13:"was_connected";b:1;}} ga_merchants: databaseStructure: Loaded ini file: ../etc/gotapex_vb354.ini ga_merchants: GET: merchantid 13 Array ( [0] => merchantid ) ga_merchants: find: 1 ga_merchants: QUERY: SELECT * FROM ga_merchants WHERE ( ga_merchants.merchantid = 13 ) ga_merchants: query: QUERY DONE IN 0.00085687637329102 seconds ga_merchants: RESULT: O:9:"db_result":11:{s:8:"autofree";b:0;s:3:"dbh";O:8:"db_mysql":8:{s:10:"autocommit";b:1;s:8:"dbsyntax";s:5:"mysql";s:3:"dsn";a:9:{s:7:"phptype";s:5:"mysql";s:8:"dbsyntax";s:5:"mysql";s:8:"username";s:7:"gotapex";s:8:"password";s:15:"SDFgn4iu38GEGre";s:8:"protocol";s:3:"tcp";s:8:"hostspec";s:11:"192.168.0.7";s:4:"port";b:0;s:6:"socket";b:0;s:8:"database";s:13:"gotapex_vb354";}s:8:"features";a:7:{s:5:"limit";s:5:"alter";s:8:"new_link";s:5:"4.2.0";s:7:"numrows";b:1;s:8:"pconnect";b:1;s:7:"prepare";b:0;s:3:"ssl";b:0;s:12:"transactions";b:1;}s:9:"fetchmode";i:1;s:22:"fetchmode_object_class";s:8:"stdClass";s:7:"options";a:8:{s:16:"result_buffering";i:500;s:10:"persistent";b:0;s:3:"ssl";b:0;s:5:"debug";i:0;s:14:"seqname_format";s:6:"%s_seq";s:8:"autofree";b:0;s:11:"portability";i:0;s:8:"optimize";s:11:"performance";}s:13:"was_connected";b:1;}s:9:"fetchmode";i:1;s:22:"fetchmode_object_class";s:8:"stdClass";s:11:"limit_count";N;s:10:"limit_from";N;s:10:"parameters";a:0:{}s:5:"query";s:81:"SELECT * FROM ga_merchants WHERE ( ga_merchants.merchantid = 13 ) ";s:6:"result";i:0;s:11:"row_counter";N;s:9:"statement";N;} ga_merchants: find: CHECK autofetchd 1 ga_merchants: find: ABOUT TO AUTOFETCH ga_merchants: FETCH: a:11:{s:10:"merchantid";s:2:"13";s:8:"legacyid";s:1:"1";s:13:"alphanumindex";s:1:"1";s:8:"merchant";s:14:"123Inkjets.com";s:7:"website";N;s:8:"urlstart";s:40:"http://www.qksrv.net/click-268435-512018";s:9:"urlmiddle";s:5:"?sid=";s:6:"urlend";s:8:"&afsrc=1";s:6:"active";s:1:"1";s:12:"totalcoupons";s:1:"7";s:12:"validcoupons";s:1:"7";} ga_merchants: fetchrow LINE: merchantid = 13 ga_merchants: fetchrow LINE: legacyid = 1 ga_merchants: fetchrow LINE: alphanumindex = 1 ga_merchants: fetchrow LINE: merchant = 123Inkjets.com ga_merchants: fetchrow LINE: website = ga_merchants: fetchrow LINE: urlstart = http://www.qksrv.net/click-268435-512018 ga_merchants: fetchrow LINE: urlmiddle = ?sid= ga_merchants: fetchrow LINE: urlend = &afsrc=1 ga_merchants: fetchrow LINE: active = 1 ga_merchants: fetchrow LINE: totalcoupons = 7 ga_merchants: fetchrow LINE: validcoupons = 7 ga_merchants: fetchrow: ga_merchants DONE ga_merchants: find: DONE ga_merchant_categories: CONNECT: Checking for database database_ in options ga_merchant_categories: CONNECT: USING CACHED CONNECTION ga_merchant_categories: links: Loaded links.ini file: ../etc/gotapex_vb354.links.ini FormBuilder: ...reorder not supported, fb_preDefOrder is not set or is not an array, returning _getFieldsToRender... FormBuilder: Setting rule for merchant a:3:{s:9:"validator";s:8:"required";s:4:"rule";b:0;s:7:"message";s:25:"The field %s is required.";} FormBuilder: Adding required rule for merchant And, just for the hell of it, here's the HTML output: <form action="/dev.gotapex.com/trunk/pub/gotapex/admin/ga_merchants.php" method="post" name="ga_merchants" id="ga_merchants" target="_self"> <div> <input name="_qf__ga_merchants" type="hidden" value="" /> <input name="merchantid" type="hidden" value="13" /> <input name="op" type="hidden" value="edit" /> <table border="0">
        <tr>
                <td align="right" valign="top"><span style="color:
#ff0000">*</span>Merchant</td>
                <td valign="top" align="left"><input name="merchant" type="text"
value="123Inkjets.com" /></td>
        </tr>
        <tr>
                <td align="right" valign="top">Urlstart</td>
                <td valign="top" align="left"><input name="urlstart" type="text"
value="http://www.qksrv.net/click-268435-512018" /></td>
        </tr>
        <tr>
                <td align="right" valign="top">Urlmiddle</td>
                <td valign="top" align="left"><input name="urlmiddle" type="text"
value="?sid=" /></td>
        </tr>
        <tr>
                <td align="right" valign="top">Urlend</td>
                <td valign="top" align="left"><input name="urlend" type="text"
value="&amp;afsrc=1" /></td>
        </tr>
        <tr>
                <td align="right" valign="top">Active</td>
                <td valign="top" align="left"><input name="active" type="checkbox"
value="1" id="qf_5070f2" checked="checked" /></td>
        </tr>
        <tr>
                <td align="right" valign="top"></td>
                <td valign="top" align="left"><input name="__submit__" value="Submit"
type="submit" /></td>
        </tr>
        <tr>
                <td></td>
        <td align="left" valign="top"><span style="font-size:80%;
color:#ff0000;">*</span><span style="font-size:80%;"> denotes required field</span></td>
        </tr>
</table> </div> </form> Any help is much appreciated! -- View this message in context: http://www.nabble.com/FormBuilder-Crosslinks-Problem-tf2143615.html#a5917424 Sent from the Pear - General forum at Nabble.com. -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- Justin Patrin

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