Results 1 to 4 of 4

Thread: Checkbox/dropdown relationship

  1. #1
    Neilltech is offline Member
    Join Date
    Mar 2010
    Posts
    11

    Default Checkbox/dropdown relationship

    Hello,

    I'm quite new with Sugar and am currently setting up custom fields and layouts in Studio. I was wondering if it would be possible to create a dropdown list field that only shows up when a checkbox is selected. Or even just make it so that nothing can be selected in that list unless the box has been checked.

    Don't know if this can be done, any advice would be greatly appreciated!

    Respectfully,
    Roberto Ruiz
    Neill Technologies
    roberto.ruiz@neill.com

  2. #2
    robertbmirth is offline Sugar Community Member
    Join Date
    Jun 2010
    Location
    Irvine, CA
    Posts
    345

    Default Re: Checkbox/dropdown relationship

    Why not just combine the two custom fields into one? I mean, if the checkbox is controlling the dropdown, couldn't you just have an "Unchecked" entry in the dropdown menu?

    If you can't do that, then I don't know how you can do exactly what you want, but functionally, you can create a logic hook that resets the value in the dropdown list to blank if the checkbox isn't checked. Something like:

    PHP Code:
    <?php

    LogicHookClass
    {
        
    LogicHookFunction(&$bean$event$argument)
        {
            if(empty(
    $bean->activate_dropdown_c) || $bean->activate_dropdown_c == 0)
           {
               
    $bean->dropdown_c '';
           }
        }
    }
    ?>
    One problem with this is that if you had a user that didn't know your dropdown and checkbox were connected, they wouldn't understand why the dropdown keeps on resetting itself and would probably get frustrated at it. Got any coworkers you don't like?
    Last edited by robertbmirth; 2010-08-06 at 05:48 PM. Reason: Added a caveat

  3. #3
    Neilltech is offline Member
    Join Date
    Mar 2010
    Posts
    11

    Default Re: Checkbox/dropdown relationship

    Thanks for your reply. I was trying to do this since my company offers many software enhancements that are only available to certain types of customer, so an option that locked down a dropdown until selected would help avoid customers being quoted on enhancements they can't have. If it's not possible to do this I can live without it. Thanks for your help though!

    Respectfully, Roberto Ruiz

  4. #4
    robertbmirth is offline Sugar Community Member
    Join Date
    Jun 2010
    Location
    Irvine, CA
    Posts
    345

    Default Re: Checkbox/dropdown relationship

    You might be able to do something similar to what happens here:
    http://www.sugarcrm.com/forums/showthread.php?t=63502

    I'm not entirely sure, but it looks like your problem and the problem in that thread are very similar, so might be worth looking into.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Checkbox instead of dropdown.
    By hensor in forum Developer Help
    Replies: 1
    Last Post: 2009-06-16, 11:37 AM
  2. Checkbox becomes DropDown
    By madmat in forum Help
    Replies: 1
    Last Post: 2009-03-03, 02:58 PM
  3. checkbox shows up as dropdown
    By Rudi Mentär in forum Developer Help
    Replies: 1
    Last Post: 2008-12-02, 11:03 AM
  4. Novo campo dropdown ou checkbox...
    By pmaonline in forum Portugese
    Replies: 5
    Last Post: 2008-11-19, 06:18 PM
  5. Replies: 0
    Last Post: 2006-03-10, 02:51 AM

Tags for this Thread

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
  •