Filtering Lookups with values from two fields

The recommended method of customizing your AppGini-generated application is through hooks. But sometimes you might need to add functionality not accessible through hooks. You can discuss this here.
Post Reply
miwalder
Posts: 11
Joined: 2013-02-11 20:36
Location: Switzerland
Contact:

Filtering Lookups with values from two fields

Post by miwalder » 2015-04-20 01:49

I have a database with the following tables: students, parents, and payment receipts. In the students table there are two lookup fields one for the father and one for the mother of each student. When I insert a new payment for a student a have a «from» lookup field where I can choose a parent from a dropdown list. The next field called «for» is another dropdownlist where I can select the student which studies are being paid. So far everthing works fine but now when I choose a parent from the list I want to filter the next lookup field for the students when a parent above is selected only the students which are related to this parent are shown. This is possible with the automated filtering options for cascading dropdowns. The problem ist when I choose a father it shows the related students exactly, but when I chose a mother the dropdownlist is blank.
After some investigation I found out, part of the solution in the file «ajax_combo» in this line:

Code: Select all

'filterers' =>  array('in_from' => 'st_father'),
I can change this to:

Code: Select all

'filterers' =>  array('in_from' => 'st_mother'),
This works fine, but now all the mothers selected, show the related children, but the fathers don't show results. What I want to do is, merge the results from 'st_father' and 'st_mother' in the array but I don't how. Any ideas?

Post Reply