Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: How to create Dependent Dropdown for state and city?

  1. #1
    phpdon is offline Member
    Join Date
    Dec 2010
    Location
    New delhi ,India
    Posts
    11

    Default How to create Dependent Dropdown for state and city?

    Hello,

    Please anyone can give a simple example for creating Dependent Dropdown for my module contacts.I want to add state and corresponding their city.

    I am using CE6.1.

    I have go through Sugar_Developer_Guide_6.1.0 but not able to implement .I would not like to use devtoolkit.


    Please suggest.

    Regards

  2. #2
    jmertic is offline Sugar Community Manager
    Join Date
    Dec 2007
    Posts
    2,224

    Default Re: How to create Dependent Dropdown for state and city?

    You are looking at adding custom JS code in CE, which would call an AJAX request to pull in the correct data for those two fields.

  3. #3
    phpdon is offline Member
    Join Date
    Dec 2010
    Location
    New delhi ,India
    Posts
    11

    Default Re: How to create Dependent Dropdown for state and city?

    Hello,

    I want to use like below

    Dependent Dropdowns are dropdowns who‟s options change when the selected value in a trigger
    dropdown changes. The metadata is defined in the vardefs and contains two major components, a
    “trigger” id which is the name of the trigger dropdown field and a „visibility grid‟ that defines the set
    of options available for each key in the trigger dropdown. For example, you could define a sub-
    industry field in accounts whose available values depend on the industry field.
    <?php
    'sub_industry_c' => array(
    'name'
    => 'sub_industry_c',
    'type'
    => 'enum',
    'options'
    => 'sub_industry_dom',
    'visibility_grid'=> array(
    'trigger' => 'industry',
    'values'
    => array(
    'Education' => array('primary', 'secondary', 'college'),
    'Engineering' => array('mechanical', 'electrical', 'software'),
    ),
    ),
    )

    ?>

    Regards

  4. #4
    shyam007 is offline Sugar Community Member
    Join Date
    Dec 2008
    Location
    Pune
    Posts
    203

    Default Re: How to create Dependent Dropdown for state and city?

    Hi all,

    I also fetching same problem, means I am not able to create a Dependent Dropdown using "Sugar Logic" framework.

    Please help us.
    Shyam
    Mumbai - India.


    shyam.fc@gmail.com

    SugarCRM (CE & PRO):- 6.1.*
    Operating System :- CentOS 5.5
    PHP Version:- 5.2.17
    Apache :-2
    MYSQL :-5.0

  5. #5
    dsuvankar is offline Sugar Community Member
    Join Date
    Sep 2008
    Posts
    187

    Default Re: How to create Dependent Dropdown for state and city?


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

    Default Re: How to create Dependent Dropdown for state and city?

    In your example:

    Quote Originally Posted by phpdon View Post
    Hello,

    I want to use like below

    Dependent Dropdowns are dropdowns who‟s options change when the selected value in a trigger
    dropdown changes. The metadata is defined in the vardefs and contains two major components, a
    “trigger” id which is the name of the trigger dropdown field and a „visibility grid‟ that defines the set
    of options available for each key in the trigger dropdown. For example, you could define a sub-
    industry field in accounts whose available values depend on the industry field.
    <?php
    'sub_industry_c' => array(
    'name'
    => 'sub_industry_c',
    'type'
    => 'enum',
    'options'
    => 'sub_industry_dom',
    'visibility_grid'=> array(
    'trigger' => 'industry',
    'values'
    => array(
    'Education' => array('primary', 'secondary', 'college'),
    'Engineering' => array('mechanical', 'electrical', 'software'),
    ),
    ),
    )

    ?>

    Regards

    Can one replace the list of values with an existing dropdown?

    For example, I have:
    Country dropdown, State dropdown (state_list_DD), and Province dropdown (province_list_DD) defined in Sugar via Studio

    The idea is to do something like

    $dictionary['addlo_Address_Locations']['fields']['address_state']=
    array(
    'name' => 'address_state',
    'vname' => 'LBL_ADDRESS_STATE',
    'type' => 'enum',
    'visibility_grid' => array('trigger' => 'address_country',
    'values' => array(
    'CANADA' => 'province_list_DD',
    'USA' => 'state_list_DD',
    )
    ),
    'comment' => 'The state or province used for the address',
    'merge_filter' => 'enabled',
    );
    ?>

    Thanks,
    Francesca

  7. #7
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: How to create Dependent Dropdown for state and city?

    I already implemented this functionality many times on sugar, and basicaly what I do is:
    1. Create a java script function that read the current select option for "state".
    2. Develop an external php page that returns a list of all cities based in a state passed as paramenter.
    3. Develop a javascript function that access this external page passing as parameter the value of selected state, and also update the cities list.
    4. Assign the function developed on step 3 to the onchange event of state field.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  8. #8
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: How to create Dependent Dropdown for state and city?

    This can be easily implemented by DevToolKit.
    You can find the link to project page at my signature.

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  9. #9
    Shripad1988 is offline Sugar Community Member
    Join Date
    Jan 2012
    Location
    Pune
    Posts
    65

    Default Re: How to create Dependent Dropdown for state and city?

    Hi rafael,
    Well im facing problems in implementing this drop-down code.Could u please specify which files to change and what code should be written in that?Even send the javascript file which u mentioned showing a small example.

    Thnxs,

    Regards..

  10. #10
    juanmrs is offline Junior Member
    Join Date
    Feb 2012
    Posts
    2

    Default Re: How to create Dependent Dropdown for state and city?

    Quote Originally Posted by Shripad1988 View Post
    Hi rafael,
    Well im facing problems in implementing this drop-down code.Could u please specify which files to change and what code should be written in that?Even send the javascript file which u mentioned showing a small example.

    Thnxs,

    Regards..


    Hello, i am having troubles implementing devtoolkit, i have sugar Versión 5.5.0 (Build 6653)
    i have installed devtoolkit, ,

    At first i replaced edit.view, list and detail in MVC/view/view..., but i got errrors.

    then i modify the actual files inserting the function, but module is not changing the dependant dropdowns..

    could you plase provide information about changing edit.view.php in my case has function like predisplay, display.. etc..

    thanks in advanced, i am folowing instructions from user guide.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Dependent Dropdown - Help!
    By m3suriya in forum Developer Help
    Replies: 0
    Last Post: 2010-11-27, 06:09 AM
  2. Replies: 3
    Last Post: 2009-11-18, 11:59 PM
  3. Replies: 0
    Last Post: 2009-09-21, 06:24 PM
  4. Dropdown for City, State and Country
    By SVydelingum in forum Help
    Replies: 15
    Last Post: 2008-12-11, 09:52 AM
  5. Replies: 0
    Last Post: 2007-02-18, 11:27 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
  •