| Justin Patrin 2005-07-24, 8:39 pm |
| On 7/20/05, Thomas Balthazar <tba@voxteneo.com> wrote:
> Hi everybody,
>=20
> Here is my problem :
>=20
> 1/ I have a m:n relationship between DOCUMENTS, COUNTRY.
> So I have 3 tables DOCUMENTS, JOIN, COUNTRY.
>=20
> 2/ In COUNTRY, I have a flag saying if a country is in the EU or not.
>=20
> 3/ I have set up FormBuilder to display a multi-select filled in with
> the countries in the DOCUMENTS form. Ok, simple.
>=20
> 4/ I can filter the COUNTRIES with the prepareLinkedDataObject function,
> so that only COUNTRIES from the EU are displayed.
>=20
> 5/ For some reasons, what I want to do is to display 2 multi-select :
> - one with the COUNTRIES inside EU
> - one with the COUNTRIES outside EU
>=20
> And I really cannot figure out how to do that.
>=20
This would be kind of a split of one element into two. There's not
really any way to do this with FormBuilder at the moment. If you had
seperate columns in the JOIN table for EU and non-EU countries I could
help you hack it, but that's not a good solution for this problem.
You could fix this in one of many ways (as usual). I suggest that you
add an element in postGenerateForm (remember you can use
HTML_QuickForm::insertElementBefore() to put it where you want it).
Make this element the one with the non-EU countries and use
DB_DataObject_FormBuilder::getDataObject
String() to get the display
string for each country. Name it something special which won't collide
with your other elements. Then in preProcessForm take the values from
your new select andmerge them with the EU one that FormBuilder
created. (use + instead of array_merge as array_merge breaks numeric
keys...and PHP treats string keys with #'s as #'s....argh).
If you need more help just ask. :-)
--=20
Justin Patrin
|