Results 1 to 9 of 9

Thread: searching based on value selected from dropdown list in popup

  1. #1
    sawan is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    130

    Default searching based on value selected from dropdown list in popup

    Hello everyone,

    i have custom modules housingprovider and housingsubgroups,housinggroups
    each housing group can havemany subgroups but not vice-versa.

    each housing provider can be related to many subgroups and vice-versa.

    housing sub group is related with housing group.
    housingprovider is related wioth housing sub group.

    i want a dropdown list of groups in popup menu which comes by clicking on select button from subgroups sub panel in housing provider detail page.

    on selecting a value from this dropdown list only subgroups of this selected group should be displayed in list in popup.

    i have created so far a dynamic dropdown list which gets data from db and fills with all groups.
    and i have also created a field 'hgsellist_c which has valued as this dropdown list and placed it in searchdefs.php file

    here is the code of searchdefs.php in modules\housingsubgroup\metada

    $module_name = 'H5555_HousingSubGroup';
    $searchdefs[$module_name] = array(
    'templateMeta' => array(
    'maxColumns' => '3',
    'widths' => array('label' => '10', 'field' => '30'),
    ),
    'layout' => array(
    'basic_search' => array(
    'name',
    array('name'=>'current_user_only', 'label'=>'LBL_CURRENT_USER_FILTER', 'type'=>'bool'),
    'hgsellist_c' =>
    array (
    'label' => 'LBL_HGSELLIST',
    'width' => '10',
    'name' => 'hgsellist_c',
    'default_value' => '',
    ),
    ),
    'advanced_search' => array(
    'name',
    array('name' => 'assigned_user_id', 'label' => 'LBL_ASSIGNED_TO', 'type' => 'enum', 'function' => array('name' => 'get_user_array', 'params' => array(false))),

    'hgsellist_c' =>
    array (
    'label' => 'LBL_HGSELLIST',
    'width' => '10',
    'name' => 'hgsellist_c',
    'default_value' => '',
    ),s
    ),
    ),
    );
    ?>


    i am trying this,please help me.
    it really urgent.
    your help would be vewry much appericiable

  2. #2
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: searching based on value selected from dropdown list in popup

    Hi Sawan,

    As I understand, you want to build dynamic dropdowns that:
    1. read values stored into a db table and show them
    2. once a value is selected in one dropdown, the other shows only those values concerning the data selected in first dropdown.
    You could find a couple of threads of mine useful:

    here and here I explain how to build dynamic dropdowns;
    here I show how to link a db table to a dropdown.

    You'll have to adapt the examples to your needs, but I think it's basically all you need.
    What do you think the cookie monster eats ?

  3. #3
    sawan is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    130

    Default Re: searching based on value selected from dropdown list in popup

    Hey thanks for looking in to the problem DragonflyMaster.
    Your code will be helpful in building dropdown lists.


    i will explain in detail.

    Three modules are in question:HousingGroup,HousingSubGroup,HousingProvi der.

    Each Housinggroup can have many housingsubgroups but not vice-versa.These two modules are related.eg.Housinggroup California can have HousingSubGroup's SanJose,LosAngeles etc.

    Each housingprovider is related to many housingsubgroups and vice-versa.
    eg.Great HousingProvider provides housing in LosAngeles,San jose etc.

    In housing provider's detail view there is a subpanel of Housingsubgroup as both are both are related.

    Now on clicking the select button on Housingsubgroup subpanel, a popup of list of all housingsubgroups is opened.


    Now what i am trying for is:

    1) Place a dropdown list of HousingGroups in this popup's search section and after selecting a housinggroup from this its only its corresponding housingsubgroups will be listed in the main listview below.

    for this i have currently made a dynamic dropdown list which fetches all the housinggroups from DB and made a field in housingsubgroup which has this dropdown as values.
    I have placed this field in search view in SearchDefs.php and it is shown with data when popup opens.
    But this field deos not have any value in DB in HousingSubGroup's table because module was made much earlier with nearly 73 records entered , and this fetaure is to be added now.

    But the problem is i dont know the flow for popup and where the query for fetching the records is declared.

    What shall i do? Please guide me.
    Its really urgent.
    Your help will be very much appericiable.
    Thanks again for looking in the problem.

  4. #4
    sawan is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    130

    Default Re: searching based on value selected from dropdown list in popup

    Ok i will try this.
    Hey thanks again.

  5. #5
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: searching based on value selected from dropdown list in popup

    Quote Originally Posted by sawan
    ...
    Place a dropdown list of HousingGroups in this popup's search section and after selecting a housinggroup from this its only its corresponding housingsubgroups will be listed in the main listview below.
    Without going too much in details, I can see here 2 ways to accomplish this task:
    a) In the search form create a second dropdown that shows only those housingSubgroups related to the housingGroup chosen in the first dropdown;
    b) Manually write a query to extract from db all HousingGroups and then filter them by Joining with corresponding housingSubgroups.
    Quote Originally Posted by sawan
    ...
    But the problem is i dont know the flow for popup and where the query for fetching the records is declared.
    Look in yourModuleName\metadata\popupdefs.php, searchdefs.php and searchfields.php.
    What do you think the cookie monster eats ?

  6. #6
    sawan is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    130

    Default Re: searching based on value selected from dropdown list in popup

    Hey DragonflyMaster,
    this does not seem feasible because again the problem of accessing dropdown for fetching values arises.
    i am trying.
    please if you have some idea for getting dropdown values guide me.
    thanks again.

  7. #7
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: searching based on value selected from dropdown list in popup

    Quote Originally Posted by sawan
    Hey DragonflyMaster,
    this does not seem feasible because again the problem of accessing dropdown for fetching values arises.
    i am trying.
    please if you have some idea for getting dropdown values guide me.
    thanks again.
    Read the posts I previously linked in my first post in this thread.
    In my example the second dropdown fetches values perfectly.
    I'm not saying it will work perfectly for you too, but at least you'll get the idea on how it works.
    What do you think the cookie monster eats ?

  8. #8
    sawan is offline Sugar Community Member
    Join Date
    Dec 2007
    Posts
    130

    Default Re: searching based on value selected from dropdown list in popup

    Ok i have found a solution (actually i have not found it,it was present,but is tedious and i did not want to go for it)i will try for a better solution.
    The solution is:
    since the field which i have made is a part of HousingSubgroups module.so for each subgroups if we go in edit page and assign a HousingGroup to selected subgroup then,while searching in popup ofcourse it will display only SubGroups of selected Group.


    But still i am trying for a better solution because for this the client will have to assign a group to each subgroup by going in edit pages and there are 73 subgroups,if made earlier this was a good solution.
    Last edited by sawan; 2008-04-08 at 10:44 AM.

  9. #9
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: searching based on value selected from dropdown list in popup

    Quote Originally Posted by sawan
    But still i am trying for a better solution because for this the client will have to assign a group to each subgroup by going in edit pages and there are 73 subgroups,if made earlier this was a good solution.
    I understand perfectly, I run through this several times.
    Anyhow, applying manual changes to 73 subgroups can be tedious, but maybe cheaper (in terms of man-time) than finding a better solution.
    What do you think the cookie monster eats ?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Target List Add from Leads popup failure
    By johnswolter in forum Help
    Replies: 0
    Last Post: 2008-02-20, 08:40 PM
  2. Related Dropdown List (conditioned)
    By nramirezf in forum Feature Requests
    Replies: 6
    Last Post: 2008-02-03, 11:01 AM
  3. populate dropdown list from database
    By ashley07 in forum Help
    Replies: 1
    Last Post: 2007-10-18, 09:58 PM
  4. Dropdown list
    By sridhar in forum Help
    Replies: 0
    Last Post: 2006-08-18, 01:54 PM
  5. Replies: 3
    Last Post: 2006-06-30, 08:43 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •