PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB_DataObject_FormBuilder » Bug #2889

Automatically create checkboxes for reverse links in forms

Details

Request #2889Automatically create checkboxes for reverse links in forms
Submitted2004-12-04 15:51 UTC
Fromc dot schneider at scram dot de
Assignedjustinpatrin
StatusClosed
PackageDB_DataObject_FormBuilder
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2004-12-04 15:51 UTC] c dot schneider at scram dot de

Description:
------------
Lets begin with a table setup again:

car
id
name
person_id

person
id
name

my database.links.ini contains:
[car]
person_id = person:id

So in a car form I get a select for person.
It would be very nice to also get checkboxes in a car form that list all persons so I can set their owners this way.
Is that possible at the moment?

[2004-12-05 00:14 UTC] c dot schneider at scram dot de

I meant in the person form .. sorry for the error. It should not be completely automatically of course. Perhaps with a config variable like display_fields. e.g. var $fb_display_reverse = array('car:person_id') in the person dataobject. What means : display reverse links from table car field person_id.

[2004-12-05 00:39 UTC] c dot schneider at scram dot de

Seems we want the same thing then ;-) That solution would be automatic enough for me.

[2004-12-16 00:41 UTC] c dot schneider at scram dot de

One possible solution to see what you are switching a field from is to display the current value beside.

A list could look like this:
[checkbox] [linkDisplayFields of Car] [linkText] [linkDisplayFields of Person the car links to]

e.g.
[ ] BMW owned by Peter
[x] Jeep
[ ] Beetle owned by Eve

Where link text could be an additional attribute for fb_reverseLinks. As you said it is destructive in the sense that checking a box removes the old owner. I hope the user understands what he is doing ;-)

The not null problem is very real of course. If the field person_id is defined not null this means the car must always be linked to a person. In this case the reverse link list makes not much sense. Formbuilder should check this and display an error when a reverse link is to be displayed and to originating field is defined not null.

In any case the list could be also used just as an information. So you can see what cars a person owns. Each item of the list could link the the edit form of the car.
Though I am not so sure the edit form is the right place for it. Normally there is also a non editable details page for each table that could also contain this.