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

Thread: Show hide feature in the detailview of a module

  1. #1
    shivaranjani is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    174

    Lightbulb Show hide feature in the detailview of a module

    Hello,
    I am using Sugarcrm 5.2.e version on linux with php 5, mysql -5 and Apchee-2.
    I have developed my module . I am at present able to view all the fields in the detail. Is it possible to "On click of a field to show all the fields in a panel in the detail view?"

    Regards,
    ShivaRanjani

  2. #2
    crmbalah is offline A Prolific Poster
    Join Date
    Mar 2009
    Location
    chennai
    Posts
    418

    Default Re: Show hide feature in the detailview of a module

    HI
    try to write "view.edit.php" inside the view.edit view you can able to write the java script.
    you can hid the panel though this java script.
    and you can write onclick script also

  3. #3
    zaska's Avatar
    zaska is offline Senior Member
    Join Date
    Sep 2008
    Posts
    99

    Default Re: Show hide feature in the detailview of a module

    You want a clickable check box in DetailView to show/hide a fields or you want to show/hide fields based if some field has a check box?

  4. #4
    shivaranjani is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    174

    Default Re: Show hide feature in the detailview of a module

    Hello,
    In the detail view I have couple of panels, among which in one of the panel i have at about 15 fields among which I want to show only 3 fields and on the forth field I place a hyper link on click of it it should open the remain fields related to the same panel in the new window.

    Regards,
    ShivaRanjani

  5. #5
    zaska's Avatar
    zaska is offline Senior Member
    Join Date
    Sep 2008
    Posts
    99

    Default Re: Show hide feature in the detailview of a module

    OK.. I'm not a JavaScript guru but check this out:

    This is mymodule/views/view.detail.php

    PHP Code:
    <?php
    if (!defined('sugarEntry') || !sugarEntry)
        die(
    'Not A Valid Entry Point');

    require_once (
    'include/MVC/View/views/view.detail.php');
    class 
    MyModuleViewDetail extends ViewDetail {
        function 
    MyModuleViewDetail() {
            
    parent::ViewDetail();
        }
        function 
    display() {
            
    $js = <<<EOQ
    <SCRIPT>
    var HiddenFields = new Array();
    HiddenFields[0] = "myfield1_cstm";
    HiddenFields[1] = "myfield2_cstm";
    HiddenFields[2] = "myfield3_cstm";
    HiddenFields[3] = "myfield4_cstm";
    // and so on..

    function showMe() {
        for (var i=0; i < HiddenFields.length; i++) {
            document.getElementById(HiddenFields[i]).style.display = "block";
        }
    }

    function hideMe() {
        for (var i=0; i < HiddenFields.length; i++) {
            document.getElementById(HiddenFields[i]).style.display = "none";
        }
    }

    hideMe();
    </SCRIPT>
    EOQ;

            
    $this->bean->my_view_link_field_cstm "<A href=\"#\" onclick=\"showMe()\">";
            
    parent::display();
            echo 
    $js;
        }
    }
    ?>
    Put the IDs of the hidden fields in HiddenFields array.
    my_view_link_field_cstm is the name of your custom field, that you will click on

  6. #6
    shivaranjani is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    174

    Default Re: Show hide feature in the detailview of a module

    Hello Friend,
    I was looking in to implement this on my developed module. I could not find the mymodules/view/view.detail.php file. Any solution where can I write the script in order to get my task done?

    Thanks for your valuable time.

    Regards,
    ShivaRanjani

  7. #7
    zaska's Avatar
    zaska is offline Senior Member
    Join Date
    Sep 2008
    Posts
    99

    Default Re: Show hide feature in the detailview of a module

    Well.. create it
    You can test first with the upgrade-safe way. Create a directory custom/modules/MyModule/views/ and put there the view.detail.php. If the view works fine you can put it in your .zip package.

  8. #8
    shivaranjani is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    174

    Default Re: Show hide feature in the detailview of a module

    Hello Friend,
    This is the flowing error I am being displayed. "Parse error: syntax error, unexpected $end in C:\wamp\www\test\custom\modules\b123_Properties\vi ews\view.detail.php on line 50".

    The code is as follows:-
    <?php
    if (!defined('sugarEntry') || !sugarEntry)
    die('Not A Valid Entry Point');

    require_once ('include/MVC/View/views/view.detail.php');
    class b123_PropertiesViewDetail extends ViewDetail {
    function b123_PropertiesViewDetail() {
    parent::ViewDetail();
    }
    function display() {
    $js = <<<EOQ
    <SCRIPT>
    var HiddenFields = new Array();
    /*HiddenFields[0] = "myfield1_cstm";
    HiddenFields[1] = "myfield2_cstm";
    HiddenFields[2] = "myfield3_cstm";
    HiddenFields[3] = "myfield4_cstm"; */

    HiddenFields[0] = "property_type_cstm";
    HiddenFields[1] = "bathrooms_c_cstm";
    HiddenFields[2] = "country_c_cstm";
    HiddenFields[3] = "electric_please_explain_c_cstm";




    // and so on..

    function showMe() {
    for (var i=0; i < HiddenFields.length; i++) {
    document.getElementById(HiddenFields[i]).style.display = "block";
    }
    }

    function hideMe() {
    for (var i=0; i < HiddenFields.length; i++) {
    document.getElementById(HiddenFields[i]).style.display = "none";
    }
    }

    hideMe();
    </SCRIPT>
    EOQ;

    $this->bean->my_view_link_field_cstm = "<A href=\"#\" onclick=\"showMe()\">";
    parent::display();
    echo $js;
    }
    }
    ?>


    Regards,
    ShivaRanjani

  9. #9
    zaska's Avatar
    zaska is offline Senior Member
    Join Date
    Sep 2008
    Posts
    99

    Default Re: Show hide feature in the detailview of a module

    I guess the problem is white-spaces. Test the attached file. You can put it like it is, with no modifications. If the DetailView loads then customize it.

    Cheers
    Attached Files Attached Files

  10. #10
    shivaranjani is offline Sugar Community Member
    Join Date
    May 2008
    Posts
    174

    Default Re: Show hide feature in the detailview of a module

    Hello Friend,

    Thanks for your prompt reply.
    I am still not able to view the show and hide. Any guess why is it not functioning?

    Regards,
    ShivaRanjani

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. Editview panels show/hide?
    By madhrishi in forum Help
    Replies: 5
    Last Post: 2009-05-05, 03:47 PM
  2. Show Subpanel but hide Tab in SecuritySuite
    By rickitambo in forum Developer Help
    Replies: 1
    Last Post: 2009-04-23, 06:33 PM
  3. hide tabs but show module link in shortcut Menu?
    By yanyan in forum Developer Help
    Replies: 7
    Last Post: 2008-09-09, 11:50 AM
  4. How to hide subpanels from the DetailView of Modules?
    By ingo.jaeckel in forum Developer Help
    Replies: 4
    Last Post: 2008-06-26, 11:52 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
  •