Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By Francescas

Thread: Drop Down Lists

  1. #1
    jason.staines's Avatar
    jason.staines is offline Sugar Community Member
    Join Date
    Feb 2011
    Location
    Harlow, Essex, UK
    Posts
    74

    Default Drop Down Lists

    Hi

    I want to start out by saying I love the new features where you are able to change the contents of a drop down list based on the choice made in a parent drop down list. However, I would have preferred it if this had been separate from the dependency option. I have a requirement when I need to alter the contents of a drop down based on one drop down but also make the it visible or invisible based on the contents of another drop down. e.g. I have a Result field for phone calls. I also have a call type field which will determine which entries are available in the call result drop down list. However, I also only want to make the result field visible and required once the status of the call has been set to held.

    There are also some features of the dependent drop down feature which are a little "buggy"

    I like to make the first entry in the drop down list blank and make this the default value. If you do this with a drop down which has a parent it skews all the result sets.
    e.g. I have my call classifications configured like this
    Name:  ddl_list.JPG
Views: 651
Size:  25.3 KB
    When i come to make my selection this is what I can see
    Name:  ddl_list1.JPG
Views: 620
Size:  19.5 KB.
    As you can see the selection of "Service" in the business area field shows the entries for the "Sales" option. This skew is carried through across the whole of the list.

    I have found a way of countering acting this by placing the parent blank entry at the bottom of the drop down list. However this has a knock on effect where by if you have specified Blank as the default value the field defaults to the first entry in the list.

    Any help in this area would be greatly appreciated.
    Attached Images Attached Images  
    Last edited by jason.staines; 2013-01-11 at 08:27 AM.

  2. #2
    wjwood64 is offline Member
    Join Date
    May 2007
    Posts
    13

    Default Re: Drop Down Lists

    Jason,

    I am puzzled. Where are you finding this ability to edit the drop down field dependencies? I would be happy to just be able to do a one to one dependency. I can not find the screen you are showing to create the drop down options. I know where the drop down editor is and am familiar with it. Just don't know where you build these relationships.

  3. #3
    jason.staines's Avatar
    jason.staines is offline Sugar Community Member
    Join Date
    Feb 2011
    Location
    Harlow, Essex, UK
    Posts
    74

    Default Re: Drop Down Lists

    Hi WJ

    I am using Sugar Pro 6.5.7. Which version are you using?

  4. #4
    wjwood64 is offline Member
    Join Date
    May 2007
    Posts
    13

    Default Re: Drop Down Lists

    Sugar CE 6.5.10

    Based on your version I am guessing this is only available in the paid versions of the app... Grrrr...

  5. #5
    jason.staines's Avatar
    jason.staines is offline Sugar Community Member
    Join Date
    Feb 2011
    Location
    Harlow, Essex, UK
    Posts
    74

    Default Re: Drop Down Lists

    HI

    It would look that way. However, I think you can achieve something similar using the development tool kit which is available from the sugar forge.

  6. #6
    Francescas's Avatar
    Francescas is offline Sugar Community Member
    Join Date
    Dec 2011
    Location
    Colorado
    Posts
    508

    Default Re: Drop Down Lists

    Jason, this should work for you, I usually do these in code not studio.
    Say you are in <yourmodule> and want dropdownA to change the values in dropdownB
    also dropdownB should display only if fieldC has a value of "C1".

    in custom/Extension/modules/<yourmodule>/Ext/Vardefs/<choose_a_name>.php

    The visibility_grid determines which category values are displayed for which values of the trigger dropdown
    While the dependency determines when the dropdown is visible

    To Show B1 and B2 when A1 is chosen
    and B3 when A2 is chosen:

    PHP Code:
    $dictionary['<yourmoduleSingular>']['fields']['dropdownB']['visibility_grid'] = array (
       
    'trigger' => 'dropdownA',
       
    'values' => array (
                            
    'A1'=>array(
                                    
    '' //the empty option if you want it
                                    
    ,'B1'
                                    
    ,'B2'
                            
    ),
                            
    'A2'=>array(
                                    
    ''
                                    
    ,'B3'
                            
    ),
       ),
    ); 
    To hide dropdownB unless fieldC == C1
    in that same vardef extension file:
    PHP Code:
    $dictionary['<yourmoduleSingular>']['fields']['dropdownB']['dependency'] = 'equal($fieldC,"C1")'
    Additionally you can make the dropdown mandatory, say you want dropdownB to be mandatory when dropdwnA value is A1:
    custom/Extension/modules/<yourmodule>/Ext/Dependencies

    PHP Code:
    <?php
    $dependencies
    ['<yourmodule>']['dropdownB'] = array(
            
    'hooks' => array("edit"),
            
    'trigger' => 'true',
            
    'triggerFields' => array('dropdownA'),
            
    'onload' => true,
            
    //Actions is a list of actions to fire when the trigger is true
            
    'actions' => array(
                    array(
                            
    'name' => 'SetRequired',
                            
    //The parameters passed in will depend on the action type set in 'name'
                            
    'params' => array(
                                    
    'target' => 'dropdownB',
                                    
    'label'  => 'dropdownB_label',
                                    
    'value' => 'equal($dropdownA, "A1")',
                            ),
                    ),
            ),
    );
    make sure the values are always the database values (not what the user sees in the front end).
    Also note that the module name is singular (e.g. Contact) for the vardefs, but plural (e.g. Contacts) for the dependencies.

    HTH
    Francesca
    Last edited by Francescas; 2013-06-17 at 01:34 PM.
    jason.staines likes this.
    Francesca
    =========
    SugarCRM Professional 6.5.15
    Linux
    Apache
    MySql
    PhP

  7. #7
    jason.staines's Avatar
    jason.staines is offline Sugar Community Member
    Join Date
    Feb 2011
    Location
    Harlow, Essex, UK
    Posts
    74

    Default Re: Drop Down Lists

    Hi Francesca

    That works perfectly. Thank you!!!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dependable drop-down lists.
    By damien.english in forum General Discussion
    Replies: 2
    Last Post: 2012-07-04, 09:01 AM
  2. drop down lists
    By lalo in forum General Discussion
    Replies: 8
    Last Post: 2009-02-12, 06:35 PM
  3. Sugar 4.5.1: own drop-down lists are empty
    By andreroszik in forum Help
    Replies: 0
    Last Post: 2007-03-15, 04:04 PM
  4. Managing drop-down lists
    By ennsol in forum Feature Requests
    Replies: 0
    Last Post: 2007-01-25, 09:36 AM

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
  •