Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26
Like Tree3Likes

Thread: Hide Panels in EditView (6.5)

  1. #11
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,858

    Default Re: Hide Panels in EditView (6.5)

    Quote Originally Posted by dougancil View Post
    Merrick,

    A case has been created that is viewable via the Support Portal. An engineer will review the case and contact you as soon as possible.

    Thank you,
    Doug Ancil
    SugarCRM Support
    I don't think a support case is warranted here. Just a simply reply to the request for help would be sufficient. This isn't a bug but a development question.

    One concern I have with creating support cases (and not linking to the newly created support cases) is that it creates another silo of information. If something really does deserve a support case it should be linked to here so that everyone with similar issues can benefit from the case.
    [SIGPIC][/SIGPIC]

    Using CE and have 2 or more users? You need SecuritySuite - Teams

  2. #12
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,858

    Default Re: Hide Panels in EditView (6.5)

    Quote Originally Posted by CastleBravo View Post
    As a quick follow-up to my post that I made yesterday (which still hasn't appeared yet due to moderation time!), this is how we are currently hiding panels based on the value of a dropdown, but this is not working 100% anymore when we upgraded our test environment to 6.5.5 Pro. To be clear, if the value of $record_type_dd_c is equal to any of the IDs in the formula, the fields in the panel are not visible if you try to expand the title of the panel -- in fact, you cannot expand the panel, as clicking the chevron/arrow does nothing. However, as noted in my screenshot and prior post, the names of the panels still apear and clutter up our detail/edit views.

    Any ideas how to fix this in 6.5.5 Pro? I'm still learning PHP/JavaScript, so detailed help is very much appreciated! Thank you!
    As my previous posted solution shows you have to now show/hide the parent of lbl_editview_panel1, lbl_editview_panel14, etc. Changing your code to hide the parent of those elements will hide the title as well. This is due to a change in the dom structure.
    [SIGPIC][/SIGPIC]

    Using CE and have 2 or more users? You need SecuritySuite - Teams

  3. #13
    CastleBravo is offline Sugar Community Member
    Join Date
    Feb 2012
    Location
    California
    Posts
    52

    Default Re: Hide Panels in EditView (6.5)

    Quote Originally Posted by eggsurplus View Post
    As my previous posted solution shows you have to now show/hide the parent of lbl_editview_panel1, lbl_editview_panel14, etc. Changing your code to hide the parent of those elements will hide the title as well. This is due to a change in the dom structure.
    Hi Jason,

    Thank you for your reply!

    I'm using the files in <sugar_root>/custom/modules/Cases/metadata. Is this the correct location of the files to make the updates?

    I suppose my question is exactly where in the edit/detailviewdefs.php file do I make these updates? Below is a snippet of our detailviewdefs.

    Code:
    <?php
    $viewdefs ['Cases'] = 
    array (
      'DetailView' => 
      array (
    	'templateMeta' => 
        array (
          'form' => 
          array (
            'buttons' => 
            array (
              0 => 'EDIT',
              1 => 'DUPLICATE',
              2 => 'DELETE',
              3 => 'FIND_DUPLICATES',
              4 => 
              array (
               'customCode' => '<input title="{$MOD.LBL_CREATE_KB_DOCUMENT}" accessKey="M" class="button" onclick="this.form.return_module.value=\'Cases\'; this.form.return_action.value=\'DetailView\';this.form.action.value=\'EditView\';this.form.module.value=\'KBDocuments\'" type="submit" name="button" value="{$MOD.LBL_CREATE_KB_DOCUMENT}">',
    		  ),
            ),
          ),
      	  'maxColumns' => '2',
          'widths' => 
          array (
            0 => 
            array (
              'label' => '10',
              'field' => '30',
            ),
            1 => 
            array (
              'label' => '10',
              'field' => '30',
            ),
          ),
          'useTabs' => true,
          'syncDetailEditViews' => true,
    	  'panelDependencies' => 
          array (
            'lbl_editview_panel1' => 'equal($record_type_dd_c, "01240000000990R")',
            'lbl_editview_panel14' => 'equal($record_type_dd_c, "01240000000141F")',
            'lbl_editview_panel13' => 'equal($record_type_dd_c, "01240000000141F")',
            'lbl_editview_panel12' => 'equal($record_type_dd_c, "01240000000141F")',
            'lbl_editview_panel11' => 'equal($record_type_dd_c, "01240000000141F")',
            'lbl_editview_panel10' => 'equal($record_type_dd_c, "01240000000141F")',
            'lbl_editview_panel15' => 'equal($record_type_dd_c, "01240000000141F")',
            'lbl_editview_panel16' => 'or(equal($record_type_dd_c, "012300000000Ji6"), equal($record_type_dd_c, "012300000000Cqw"))',
            'lbl_editview_panel18' => 'equal($record_type_dd_c, "012300000000Cqw")',
            'lbl_editview_panel19' => 'equal($record_type_dd_c, "012300000000Cqw")',
            'lbl_editview_panel20' => 'equal($record_type_dd_c, "0124000000013gH")',
            'lbl_editview_panel21' => 'equal($record_type_dd_c, "0124000000013gH")',
            'lbl_editview_panel22' => 'equal($record_type_dd_c, "012300000000OQ2")',
            'lbl_editview_panel23' => 'equal($record_type_dd_c, "0124000000014qm")',
            'lbl_editview_panel24' => 'equal($record_type_dd_c, "0123000000094Wh")',
            'lbl_editview_panel25' => 'equal($record_type_dd_c, "0123000000094Wh")',
            'lbl_editview_panel26' => 'equal($record_type_dd_c, "0123000000094Wh")',
            'lbl_editview_panel27' => 'equal($record_type_dd_c, "012300000000CvI")',
            'lbl_editview_panel28' => 'equal($record_type_dd_c, "012300000000Chf")',
            'lbl_editview_panel29' => 'equal($record_type_dd_c, "0124000000015HJ")',
            'lbl_editview_panel3' => 'equal($record_type_dd_c, "01240000000990R")',
            'lbl_editview_panel30' => 'equal($record_type_dd_c, "0124000000015HJ")',
            'lbl_editview_panel31' => 'equal($record_type_dd_c, "0124000000015HJ")',
            'lbl_editview_panel34' => 'equal($record_type_dd_c, "0124000000014qm")',
            'lbl_editview_panel35' => 'equal($record_type_dd_c, "0124000000014qm")',
            'lbl_editview_panel36' => 'equal($record_type_dd_c, "0124000000014qm")',
            'lbl_editview_panel37' => 'or(equal($record_type_dd_c, "0124000000014qm"), equal($record_type_dd_c, "012300000000OQ2"))',
            'lbl_editview_panel4' => 'equal($record_type_dd_c, "01240000000990R")',
            'lbl_editview_panel5' => 'equal($record_type_dd_c, "01240000000990R")',
            'lbl_editview_panel6' => 'equal($record_type_dd_c, "0124000000097fm")',
            'lbl_editview_panel7' => 'equal($record_type_dd_c, "01240000000990R")',
            'lbl_editview_panel8' => 'equal($record_type_dd_c, "0124000000014DL")',
            'lbl_editview_panel9' => 'equal($record_type_dd_c, "0124000000014DL")',
            ),
          'tabDefs' => ....
    So let's say I want to hide the bar for LBL_EDITVIEW_PANEL7, I would use $('#LBL_EDITVIEW_PANEL7').parent().hide();. My question is where in the edit/detailviewdefs.php do I do this?

    I've tried:

    Code:
    array (
    	'templateMeta' => 
        array (
            'customCode' => '$("#LBL_EDITVIEW_PANEL7").parent().hide();',      // This is where I'm trying to insert it
        array (
          'form' => 
          array (
            'buttons' => 
            array (
              0 => 'EDIT',
              1 => 'DUPLICATE',
              2 => 'DELETE',
              3 => 'FIND_DUPLICATES',
              4 => 
              array (
               'customCode' => '<input title="{$MOD.LBL_CREATE_KB_DOCUMENT}" accessKey="M" class="button" onclick="this.form.return_module.value=\'Cases\'; this.form.return_action.value=\'DetailView\';this.form.action.value=\'EditView\';this.form.module.value=\'KBDocuments\'" type="submit" name="button" value="{$MOD.LBL_CREATE_KB_DOCUMENT}">',
    		  ),
               ),
            ),
          ),
    After doing a quick repair/rebuild it's not hiding anything. I'm sure either my syntax is incorrect or I'm trying to do it in the wrong section of the edit/detailviewdefs.php. Hiding the parent element conditionally based on the value of a dropdown is my ultimate goal, but I first need to cross the bridge of just hiding the element always so I gain an understanding of how it all works.

    Again I appreciate your assistance, and my apologies if I was not clear in my original posts. Thank you!

  4. #14
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,858

    Default Re: Hide Panels in EditView (6.5)

    Now I see why Doug created a case. You're using SugarLogic and it isn't working as you expected. The method that we were originally using in this thread was straight javascript. For that, you would need to either 1) include a javascript file in the metadata that does the logic and show/hides the panel 2) use the javascript section of a metadata file 3) use a custom view that outputs the javascript.

    As far as why the SugarLogic isn't working as expected I bet that is by design. You may need to change over to the javascript approach instead.
    [SIGPIC][/SIGPIC]

    Using CE and have 2 or more users? You need SecuritySuite - Teams

  5. #15
    CastleBravo is offline Sugar Community Member
    Join Date
    Feb 2012
    Location
    California
    Posts
    52

    Default Re: Hide Panels in EditView (6.5)

    Quote Originally Posted by eggsurplus View Post
    Now I see why Doug created a case. You're using SugarLogic and it isn't working as you expected. The method that we were originally using in this thread was straight javascript. For that, you would need to either 1) include a javascript file in the metadata that does the logic and show/hides the panel 2) use the javascript section of a metadata file 3) use a custom view that outputs the javascript.

    As far as why the SugarLogic isn't working as expected I bet that is by design. You may need to change over to the javascript approach instead.
    Well, the SugarLogic in the edit/detailviewdefs.php is still working correctly. It properly hides the panels if the value in the dropdown ($record_type_dd_c) matches -- it's just that the title of the "hidden" panels remains and clutters up the view. So I figured if I could write some conditional statements to hide the bar of the "hidden" panels if the value of the dropdown equals whateverValue then we would be good. I'm still not certain where/how in the edit/detailviewdefs to put the code to hide one of the bars. Again, if I can get past this hurdle I think I will be much further along. Is the syntax/placement of the code below (see comments) the correct area?

    Code:
    array (
    	'templateMeta' => 
        array (
            'customCode' => '$("#LBL_EDITVIEW_PANEL7").parent().hide();',      // This is where I'm trying to insert it.  Is this the correct syntax/place to put this?
        array (
          'form' => 
          array (
            'buttons' => 
            array (
              0 => 'EDIT',
              1 => 'DUPLICATE',
              2 => 'DELETE',
              3 => 'FIND_DUPLICATES',
              4 => 
              array (
               'customCode' => '<input title="{$MOD.LBL_CREATE_KB_DOCUMENT}" accessKey="M" class="button" onclick="this.form.return_module.value=\'Cases\'; this.form.return_action.value=\'DetailView\';this.form.action.value=\'EditView\';this.form.module.value=\'KBDocuments\'" type="submit" name="button" value="{$MOD.LBL_CREATE_KB_DOCUMENT}">',
    		  ),
               ),
            ),
          ),

  6. #16
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,858

    Default Re: Hide Panels in EditView (6.5)

    It's a bit more complicated than that and would take quite a bit more time to fully explain than I have. It takes a good knowledge of both javascript and the SugarCRM framework. I honestly recommend getting professional help on this one.
    [SIGPIC][/SIGPIC]

    Using CE and have 2 or more users? You need SecuritySuite - Teams

  7. #17
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,858

    Default Re: Hide Panels in EditView (6.5)

    Here's the view javascript method from 5.2 that would need to be updated/changed appropriately: http://developers.sugarcrm.com/go.php?id=47

    And another one: Dynamic Panels(Hiding and Displaying Panels) in SugarCRM Gibson Wasukira
    [SIGPIC][/SIGPIC]

    Using CE and have 2 or more users? You need SecuritySuite - Teams

  8. #18
    CastleBravo is offline Sugar Community Member
    Join Date
    Feb 2012
    Location
    California
    Posts
    52

    Default Re: Hide Panels in EditView (6.5)

    Quote Originally Posted by eggsurplus View Post
    Here's the view javascript method from 5.2 that would need to be updated/changed appropriately: http://developers.sugarcrm.com/go.php?id=47

    And another one: Dynamic Panels(Hiding and Displaying Panels) in SugarCRM Gibson Wasukira
    Jason, I wanted to stop back in and thank you for pointing me in the right direction as it has helped tremendously. I ended up creating a new view.detail.php as shown below. The if statement works and heads each of the panels with the specified IDs just fine, but it's going to take many if statements to account for all panels that need to be hidden for each case record type (record_type_dd_c).

    I tried using
    Code:
    $('table:hidden').parent().hide();
    to hide the parent div of any child tables that are set to be hidden but unfortunately it doesn't seem to be working. Looked for some help on StackOverflow and everyone says it should be working. Depending on the value in one of the dropdowns, some tables will be set with the display: none but some will not. I figured the jQuery above would work but no dice. Not sure if it's something with Sugar or me not seeing seeing something correctly in the DOM. I know this is a jQuery help forum but anyone have any ideas? It really seems like $('table:hidden').parent().hide(); should work.

    Code:
    <div id="detailpanel_10" class="detail view detail508 expanded">
        <h4>
        <table id="LBL_EDITVIEW_PANEL2" class="panelContainer" cellspacing="0">
        <script type="text/javascript">
    </div>
    <div id="detailpanel_11" class="detail view detail508 expanded">
        <h4>
        <table id="LBL_EDITVIEW_PANEL22" class="panelContainer" cellspacing="0" style="overflow: hidden; height: 0px; display: none;">
        <script type="text/javascript">
    </div>



    Code:
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
    
    require_once('include/MVC/View/views/view.detail.php');
    
    class CasesViewDetail extends ViewDetail {
    	function CasesViewDetail(){
    		parent::ViewDetail();
    	}
    	function display() {
    
    
    $js=<<<EOQ
    	<script>
    		
    		var recordType = $("#record_type_dd_c").val();
    		
    		if (recordType === "0124000000014qm")
    		{
    			$('#LBL_EDITVIEW_PANEL7').parent().hide();
    			$('#LBL_EDITVIEW_PANEL6').parent().hide();
    			$('#LBL_EDITVIEW_PANEL24').parent().hide();
    			$('#LBL_EDITVIEW_PANEL10').parent().hide();
    			$('#LBL_EDITVIEW_PANEL16').parent().hide();
    			$('#LBL_EDITVIEW_PANEL22').parent().hide();				
    		}
    	</script>
    EOQ;
    
    			parent::display();
    			echo $js;
    		}
    	}

  9. #19
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,858

    Default Re: Hide Panels in EditView (6.5)

    Cool! I wonder with the :hidden selector if it is an ordering issue because at the time your js is ran the table is not yet hidden so the selector doesn't find any hidden table elements. Your js needs to run after the SugarLogic runs. Not sure how to properly chain it with SugarLogic. Anyone else with ideas?
    CastleBravo likes this.
    [SIGPIC][/SIGPIC]

    Using CE and have 2 or more users? You need SecuritySuite - Teams

  10. #20
    geraldclark is offline Sugar Community Member
    Join Date
    Nov 2008
    Location
    Pittsburgh PA
    Posts
    35

    Default Re: Hide Panels in EditView (6.5)

    All,

    If I'm understanding this issue correctly, couldn't you use SetPanelVisibility?

    SugarCRM Developer Blog Blog Archive Learning Sugar Logic: Using custom dependencies.


    custom/Extension/modules/MyModule/Ext/Dependencies/panelVisibility.php

    Code:
    $dependencies['MyModule']['myPanelVisibility'] = array(
    	'hooks' => array("edit","view"),
    	'trigger' => 'true', 
    	'triggerFields' => array('my_field_c'),
    	'onload' => true,
    	//Actions is a list of actions to fire when the trigger is true
    	'actions' => array(
    		array(
    			'name' => 'SetPanelVisibility',
    			//The parameters passed in will depend on the action type set in 'name'
    			'params' => array(
    				//uppercase panel id
    				'target' => 'LBL_PANEL_ID', 
    				'value' => 'equal($my_field_c, "MyValue")',
    			),
    		),
    	),
    );
    Please let me know!
    Last edited by geraldclark; 2012-10-18 at 03:24 PM.

Page 2 of 3 FirstFirst 123 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. hide panels in detailview
    By sreekanths478 in forum Developer Help
    Replies: 2
    Last Post: 2012-01-26, 09:16 AM
  2. Editview Panels not working in IE8
    By shyam007 in forum Developer Help
    Replies: 1
    Last Post: 2011-06-06, 01:36 PM
  3. How to Hide Layout Panels in usermodule??
    By m3suriya in forum Developer Help
    Replies: 1
    Last Post: 2010-07-14, 01:50 PM
  4. Editview panels show/hide?
    By madhrishi in forum Help
    Replies: 5
    Last Post: 2009-05-05, 03:47 PM
  5. Hide Panels
    By kasperd in forum Help
    Replies: 0
    Last Post: 2008-12-10, 12:44 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
  •