K
|
keithh0427 author 7/15/2020 |
I have 3 fields: country, region, encounter I also have 3 session variables: $_SESSION['UserCountry'], $_SESSION['UserRegionID'], and $_SESSION['UserEncounterID'] I place those 3 fields in the search panel and set up the dependencies. country dropdown is not dependent on any other field. region is dependent on country encounter is dependent on region In the "After table Initialized" event, I have the following code. $srchObj = SearchClause::getSearchObject("TABLENAME"); $value1 = $srchObj->getFieldValue("country"); if( $value1 == null ) { $srchObj->setFieldValue("country", $_SESSION['UserCountry'] ); } $value2 = $srchObj->getFieldValue("region"); if( $value2 == null ) { $srchObj->setFieldValue("region", $_SESSION['UserRegionID'] ); } $value3 = $srchObj->getFieldValue("encounter"); if( $value3 == null ) { $srchObj->setFieldValue("encounter", $_SESSION['UserEncounterID'] ); } This works as advertised and I only get what I want from the preset search panel with the $_SESSION variables. However... The encounter dropdown shows ALL encounters. The region dropdown shows ALL regions and the country dropdown shows ALL countries. What I thought would occur that the region dropdown would show only the regions for the selected country AND the encounter dropdown would show only the encounters for the selected region. Now, if I go to the region dropdown and select another region, only the encounters for that dropdown will be selectable. Same for the country. If I change the country, only the regions for that country will be selectable. The dropdowns are using the $_SESSION variables when I enter the page, but the dropdowns are showing ALL of the records. What do I need to do to limit the dropdown records to the dependent dropdown?? I am using 10.4 Build 35376
|
![]() |
Sergey Kornilov admin 7/16/2020 |
If you can upload your project to Demo Account - we can take a look. if( $value1 == null ) {
if (empty($value1)) {
|
K
|
keithh0427 author 7/16/2020 |
It turns out that the three fields were not tied to "Always on Search Panel". I made them always on the Search Panel and everything worked as advertised. |