Results 1 to 7 of 7

Thread: Extra Fields in accounts

  1. #1
    time2see is offline Senior Member
    Join Date
    Dec 2008
    Posts
    25

    Default Extra Fields in accounts

    Hi there
    Can someone tell me if it is possible to have 3 or 4 fields on each line instead of 2.
    I have a few check boxes that i wish to use but would like more than 2 on each line in the Accounts layout detail view.
    Look forward to some help here.

  2. #2
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: Extra Fields in accounts

    Hi time2see,

    It can be done.

    Sugar by default lines everything up in two columns, but it's easy to increase the number of columns. But for a row of checkboxes that means they are algined above and below the text fields, etc that are much bigger.

    The other option is to create your own 'Field' definition that treats several fields as one and lets you tell them exactly how to lay them out, add buttons, add features etc.

    Look at the Email addresses and Addresses on Contacts and Accounts. These are both layed out this way. In edit view you see the Primary and Opt out checkboxes right next to the email address, plus the link to add email addresses and for Address you see different size boxes layed out next to each other with the Copy from left checkbox below.

    These are defined using Smarty templates and gets you into coding right away, so this is not a Studio customization. But if you're up for some coding, look at <sugarroot>/include/SugarFields/Fields. There is also a tutorial for adding a YouTube field on the Wiki that explains how these work.

    Take a look and post any specific questions if the answer didn't scare you away.

    Phil

  3. #3
    time2see is offline Senior Member
    Join Date
    Dec 2008
    Posts
    25

    Default Re: Extra Fields in accounts

    Thanks for the reply Phil

    I have taken a look at the mentioned folder and have had a look at a few of the files.
    Nothing in there looked as though i could add a column to my untrained eye.

    If I just wanted to make extra drop downs instead of check boxes, does that change how I go about it?

    Is there a tutorial for adding an extra column?

    I have no problem getting into coding but do need a bit of help.

    Thanks once again for your time.

  4. #4
    jsagar's Avatar
    jsagar is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    Ahmedabad,India
    Posts
    242

    Default Re: Extra Fields in accounts

    hi,
    there is a setting to have a columns more than two.
    you just have to set 'maxColumns' => '3' in editviewdefs or detailviewdefs whatever you want.

    hope it helps you
    Best Regards
    ---------------------------------------
    Jaydeepsinh Sagar

  5. #5
    time2see is offline Senior Member
    Join Date
    Dec 2008
    Posts
    25

    Default Re: Extra Fields in accounts

    Hi Jaydeepsinh
    I don't have "maxcolums" in any of the files under <sugarroot>/include/SugarFields/Fields that contain that or am i in the wrong place

  6. #6
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: Extra Fields in accounts

    Hi time2see,

    First let's clarify what you want. What I understand you are requesting is to add a column to one row without affecting the other rows so that you can show several checkbox fields close together. This is different than showing 3 columns of fields for the entire page, which would result in for example 3 long text fields on the first line and 3 small checkboxes on the second line, etc.

    If you want 3 columns for the entire page, here are the top several lines of my file custom/modules/Accounts/metadata/editviewdefs.php:

    PHP Code:
    <?php
    // created: 2010-03-05 18:41:27
    $viewdefs['Accounts']['EditView'] = array (
      
    'templateMeta' => 
      array (
        
    'form' => 
        array (
          
    'buttons' => 
          array (
            
    => 'SAVE',
            
    => 'CANCEL',
          ),
        ),
        
    'maxColumns' => '2',
        
    'widths' => 
        array (
          
    => 
          array (
            
    'label' => '15',
            
    'field' => '25',
          ),
          
    => 
          array (
            
    'label' => '15',
            
    'field' => '25',
          ),
        ),
    Note that maxColumns is set to '2' and the widths of the data and labels for each column are set below it.

    But if you want to set the columns of one row differently than the others you can use the SugarFields. The tutorial for handling SugarFields that I mentioned in my first post is here. This tutorial does not add a column per se, but it explains how to use the SugarFields so that you will better understand how to create your own template. Then you can look at the Email and Address templates as examples and lay out a set of fields however you want.

    Phil

  7. #7
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: Extra Fields in accounts

    FYI, I realized I could use customCode to define one-off Smarty displays in a single field. Just put multiple fields into a single field through custom code.

    When you have a set of fields you use over and over from different tables define a new SugarFIeld. But when you have one set of fields in a single module, just use 'customCode' like in this example from my custom/modules/Accounts/metadata/detailviewdefs:

    PHP Code:
          'lbl_panel6' => 
            array (
            
    =>
              array (
              
    => 
                array (
                  
    'name' => 'has_mazaks_c',
                  
    'label' => 'LBL_MACHINES',
                  
    'customCode' => '<u>{$MOD.LBL_HAS_MAZAKS}:</u> {if $fields.has_mazaks_c.value}<i>Yes</i>{else}<i>No</i>{/if}&nbsp;&nbsp;&nbsp;&nbsp;<u>{$MOD.LBL_HAS_MILLS}:</u> {if $fields.has_mills_c.value}<i>Yes</i>{else}<i>No</i>{/if}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>{$MOD.LBL_HAS_LATHES}:</u> {if $fields.has_lathes_c.value}<i>Yes</i>{else}<i>No</i>{/if}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>{$MOD.LBL_HAS_EDM}:</u> {if $fields.has_edm_c.value}<i>Yes</i>{else}<i>No</i>{/if}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>{$MOD.LBL_HAS_LASERS}:</u> {if $fields.has_lasers_c.value}<i>Yes</i>{else}<i>No</i>{/if}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<u>{$MOD.LBL_HAS_WATERJET}:</u> {if $fields.has_waterjet_c.value}<i>Yes</i>{else}<i>No</i>{/if}',
              ),
            ), 
    You can do the same in editviewdefs definiing your own input boxes. I chose to display Yes/No rather than a checkbox for easier saves.

    Phil

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Extra fields are appearing in Edit mode
    By callumd in forum Help
    Replies: 5
    Last Post: 2010-03-10, 12:35 AM
  2. Extra fields on a many-to-many relationship
    By craigw9292 in forum Developer Help
    Replies: 3
    Last Post: 2008-07-01, 01:17 PM
  3. I need two extra modules
    By mtgright in forum Classifieds
    Replies: 4
    Last Post: 2007-05-25, 03:49 PM
  4. Newb question: how to add extra fields?
    By mwillems in forum Help
    Replies: 2
    Last Post: 2006-11-06, 07:04 PM
  5. Question about extra fields
    By summitsys in forum Help
    Replies: 1
    Last Post: 2006-07-27, 06:31 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
  •