Results 1 to 3 of 3

Thread: onclick event in editview and quickcreate for text field

  1. #1
    it@smoothfitness.com is offline Junior Member
    Join Date
    Jan 2009
    Posts
    2

    Default onclick event in editview and quickcreate for text field

    Hi there,
    I'm trying to setup an onclick javascript event for a text field both in edit view and quickcreate for a custom module. I looked at http://www.sugarcrm.com/wiki/index.p...ller_%28MVC%29 and it appears you can't attach any display params to a text field. is this accurate? I've tried several things that did not work, includinfg the normal :

    PHP Code:
    'displayParams' => 
                array (
                  
    'javascript' => 'onchange="alert(\'test\')"'
                
    ), 
    Any ideas?

    here's the full editviewdefs.php file with my testing changes:
    you'll see another attempt i made at line 102 -- did not work, but got closer.
    My goal is to populate teh name field with the value of 'parts_parts_catalog_pitem_parts_items_name'

    PHP Code:
    <?php
    $module_name 
    'pitem_parts_items';
    $viewdefs [$module_name] = 
    array (
      
    'EditView' => 
      array (
        
    'templateMeta' => 
        array (
          
    'maxColumns' => '2',
          
    'widths' => 
          array (
            
    => 
            array (
              
    'label' => '10',
              
    'field' => '30',
            ),
            
    => 
            array (
              
    'label' => '10',
              
    'field' => '30',
            ),
          ),
        ),
        
    'panels' => 
        array (
          
    'default' => 
          array (
            
    => 
            array (
              
    => 
              array (
                
    'name' => 'name',
                
    'label' => 'LBL_NAME',
              ),
              
    => 
              array (
                
    'name' => 'assigned_user_name',
                
    'label' => 'LBL_ASSIGNED_TO_NAME',
              ),
            ),
            
    => 
            array (
              
    => 
              array (
                
    'name' => 'team_name',
                
    'displayParams' => 
                array (
                  
    'display' => true,
                ),
                
    'label' => 'LBL_TEAM',
              ),
              
    => NULL,
            ),
            
    => 
            array (
              
    => 
              array (
                
    'name' => 'description',
                
    'label' => 'LBL_DESCRIPTION',
              ),
            ),
            
    => 
            array (
              
    => NULL,
              
    => 
              array (
                
    'name' => 'cost_each_c',
                
    'label' => 'LBL_COST_EACH',
              ),
            ),
            
    => 
            array (
              
    => 
              array (
                
    'name' => 'quantity_c',
                
    'label' => 'LBL_QUANTITY',
                
    'displayParams' => 
                array (
                  
    'javascript' => 'onchange="alert(this.value)"',
                ),                        
              ),
              
    => 
              array (
                
    'name' => 'total_cost_c',
                
    'label' => 'LBL_TOTAL_COST',
              ),
            ),
            
    => 
            array (
              
    => 
              array (
                
    'name' => 'wo_work_orders_pitem_parts_items_name',
                
    'label' => 'LBL_WO_WORK_ORDERS_PITEM_PARTS_ITEMS_FROM_WO_WORK_ORDERS_TITLE',
              ),
            ),
            
    => 
            array (
              
    => 
              array (
                
    'name' => 'parts_parts_catalog_pitem_parts_items_name',
                
    'label' => 'LBL_PARTS_PARTS_CATALOG_PITEM_PARTS_ITEMS_FROM_PARTS_PARTS_CATALOG_TITLE',
                
    'displayParams' => 
                array (
                  
    'field_to_name_array' => array (
                        
    'parts_parts_catalog_pitem_parts_items_name' => 'name',
                    ),
                ),                        
              ),
            ),
          ),
        ),
      ),
    );
    ?>

    Thanks for the help!

    Jordan
    Last edited by it@smoothfitness.com; 2009-03-31 at 07:13 PM.

  2. #2
    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: onclick event in editview and quickcreate for text field

    The attribute
    PHP Code:
     'displayParams' => 
     array(
        
    'javascript' => 'someevent="somefunction();"',
     ), 
    Only works for enum (dropdown/radio button) fields.
    You need to specify a customCode instead.
    The next release will include such functionality for other field types.

    Cheers
    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.

  3. #3
    Sugar Bowl is offline Member
    Join Date
    Sep 2009
    Posts
    5

    Default Re: onclick event in editview and quickcreate for text field

    Hello Andopes or Anybody,

    Please, how can one specify a customCode or get around using the onclick event for a checkbox: i.e, is there a "somevent" attribute for checkboxes in sugarCRM? Thank you.

    Sincerely,
    Akin

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 2009-01-02, 08:10 AM
  2. adding javascript to editview - how can i add an onload event
    By mikesolomon in forum Developer Help
    Replies: 2
    Last Post: 2008-06-18, 11:27 AM
  3. Apply javascript on particular event of a field
    By anamikakhadwal in forum General Discussion
    Replies: 1
    Last Post: 2008-03-26, 10:10 AM
  4. Add Custom Field to QuickCreate Subpanel
    By Meex in forum Developer Help
    Replies: 1
    Last Post: 2007-11-06, 09:56 AM
  5. EditView page: "Account" input text hangs when typing
    By guarriman in forum General Discussion
    Replies: 0
    Last Post: 2007-01-18, 10:53 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
  •