Results 1 to 3 of 3

Thread: Contact Search Form - Custom Dropdown Field

  1. #1
    aram is offline Sugar Community Member
    Join Date
    Aug 2004
    Posts
    52

    Default Contact Search Form - Custom Dropdown Field

    I created a Custom dropdown field for Contacts and put it in the Contacts View, Edit, and Advanced Search
    forms. The dropdown is populated with 5 choices, and they work fine in the Edit form. I can edit a Contact, choose an item from the dropdown, save and the View form shows the entry.

    However in the Advanced Search form the dropdown has no choices..it's still a dropdown, but there are no choices; just a blank dropdown.

    Lead Source is a drop down, and is populated fine (though it's a standard, not Custom field).
    So my Custom dropdown is doing or not doing something that the standard Lead Source dropdown is doing.

    What do I need to fix to get my Custom Field dropdown to be populated in the Advanced Search form?

    Aram
    Last edited by aram; 2005-04-29 at 02:12 AM.

  2. #2
    Thierry is offline Sugar Community Member
    Join Date
    Apr 2005
    Posts
    15

    Lightbulb Re: Contact Search Form - Custom Dropdown Field

    If my understanding is correct, you have added your new field to /modules/contacts/searchform.html, but the dropdown list is blank.

    You now need to add the following code into /modules/contacts/listview.php .
    Let's call your new field "new_field" and suppose your dropdown file is named "new_field_dom". New code in red.

    FIRST CHANGE:

    [Find the following existing code:]

    if(isset($_REQUEST['query']))
    {
    // we have a query
    if (isset($_REQUEST['name'])) $name = $_REQUEST['name'];
    ...........................


    [then add:]

    if (isset($_REQUEST['new_field'])) $new_field = $_REQUEST['new_field'];

    SECOND CHANGE:
    [Find the following existing code:]

    if (isset($_REQUEST['advanced']) && $_REQUEST['advanced'] == 'true') {
    if(isset($account_name)) $search_form->assign("ACCOUNT_NAME", $account_name);
    ..................................
    if(isset($address_country)) $search_form->assign("ADDRESS_COUNTRY", $address_country);


    [then add:]

    if (isset($new_field)) $search_form->assign("NEW_FIELD_OPTIONS", get_select_options_with_id($app_list_strings['new_field_dom'], $new_field));
    else $search_form->assign("NEW_FIELD_OPTIONS", get_select_options_with_id($app_list_strings['new_field_dom'], ''));


    Let us know if it worked!

    Thierry
    Last edited by Thierry; 2005-04-30 at 06:37 AM.

  3. #3
    aram is offline Sugar Community Member
    Join Date
    Aug 2004
    Posts
    52

    Smile Re: Contact Search Form - Custom Dropdown Field

    Thanks Thierry...
    I took a look at your suggested code changes this morning, but then saw 3.0 was released,
    and had to get that, so I took a break from massaging the code
    After the install of 3.0, I decided to give it a whirl using the field editor in the new release,
    and the upgrade handles the dropdown problem....my dropdowns are now populated
    within all the Contact fields, including Advanced Search, so no need to dig into the code.

    Awesome fix in 3.0, but I truly appreciate your extending your help to me...

    Aram

Thread Information

Users Browsing this Thread

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

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
  •