Page 1 of 4 1234 LastLast
Results 1 to 10 of 35

Thread: relationship textfield

  1. #1
    sk1983 is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    41

    Question relationship textfield

    is it possible to make an relationship between an dropdown list an a textfield.
    for example: see the module opportunities edit layout, you have the sales-stage, if you select one, then you get an other number in the probality field. that kind of thing is what I search. But then only if you select a word in the dropdown-menu that it also displays in the textfield.

    is this possible?? so yes? can anybody help me?

    greets,

    Stefan.

  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: relationship textfield

    Hi, Stefan,

    It is right possible.

    Take a look at the modules/Campaigns/metadata/editviewdefs.php

    The field campaign_type hsa a displayParam attribute with a javascript option.
    Assign the onchange value to a script which modify the style visibility of the textfield.
    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
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: relationship textfield

    While not exactly what you described, you will find this Wiki article written by DragonflyMaster helpful. It details how you can make one dropdown dependent on another dropdown.
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  4. #4
    sk1983 is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    41

    Default Re: relationship textfield

    can one of yours not tell me were I can find the code of the opportunity of the dropdown menu sales => probality textfield. this is exactly what I looking for, so that you can select an item at the dropdown menu and it shows also in the textfield. What I saw in the wiki is of 2 dropdown menu's. I don't know of this the same is?

    greets,

    Stefan.

  5. #5
    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: relationship textfield

    Hi, sk1983.

    The code is into modules/Opportunities/views/view.edit.php

    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.

  6. #6
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: relationship textfield

    Quote Originally Posted by sk1983
    can one of yours not tell me were I can find the code of the opportunity of the dropdown menu sales => probality textfield. this is exactly what I looking for, so that you can select an item at the dropdown menu and it shows also in the textfield. What I saw in the wiki is of 2 dropdown menu's. I don't know of this the same is?

    greets,

    Stefan.
    Well it's not exactly the same thing, but it can be adjusted to work with one dropdown and one textfield.
    Actually I must have such an example somewhere...
    I'm gonna look at my files and post here.
    What do you think the cookie monster eats ?

  7. #7
    sk1983 is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    41

    Default Re: relationship textfield

    Hi DragonflyMaster,

    thanks, what I exactly want is to make an Custom dropdown menu and if you select some items that it shows in the subject textfield of the notes module.

    greets,

    stefan.

  8. #8
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: relationship textfield

    OK, I' ve found my code to drive a textfield from a dropdown
    I create this inside the Accounts module. Let'see the steps I made:



    1. In Studio I created custom dropdown myDD and custom text field myTXT, saved and added both new fields to editview
    2. Added only myTXT to detailview.
    3. opened <sugar-root>\custom\modules\Accounts\metadata\editviewdef s.php and changed code for myDD with the following:
      PHP Code:
                  1 => 
        
        
        
                    array (
        
        
        
                      
      'name' => 'myDD_c',
        
        
        
                      
      'label' => 'LBL_MYDD',
        
        
        
                      
      'displayParams' => 
        
        
        
                      array (
        
        
        
                        
      'javascript' => 'onchange="changeName();"',
        
        
        
                      ),
        
        
        
                    ),
        
        
        
                  ), 
    4. Added to <sugar-root>\modules\Accounts\Account.js the following code for ChangeName function:
      Code:
      function changeName(){ 
        
       		
        
       		if (document.EditView.myDD_c.selectedIndex != 0) { 
        
       				  document.EditView.myTXT_c.value =document.EditView.myDD_c.options[document.EditView.myDD_c.selectedIndex].text;
        
       		}
        
       		else{
        
       				document.EditView.myTXT_c.value = 'Select a value from dropdown';
        
       		}	    
        
       	}
    That's pretty much it.
    In my case I used three linked dropdowns and three text fields to make address data entry: the user selects a country from the first dropdown, so that the second dropdown shows only provinces for that country; picking from second dropdown makes the third list only the cities inside that province. When user select a city from the last dropdown, data from 3 dropdowns is copied to billing_address_country, billing_address_state, billing_address_city.
    After saving, detail view shows those data inside the default textfields for billing address.
    What do you think the cookie monster eats ?

  9. #9
    sk1983 is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    41

    Default Re: relationship textfield

    Thanks DragonflyMaster,

    I'm going to try to code, but only the notes module has no Notes.js, must I just make this file?

    Greets,

    Stefan.

  10. #10
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: relationship textfield

    Quote Originally Posted by sk1983
    Thanks DragonflyMaster,

    I'm going to try to code, but only the notes module has no Notes.js, must I just make this file?

    Greets,

    Stefan.
    Well, it depends: if you have a call to javascript functions, I'd say yes.
    The alternative is to put your javascript in editviewdefs.php, but it's a practice I would avoid, expecially with looooong functions.
    To include an external .js file, locate/add the following in <sugar-root>\custom\modules\Accounts\metadata\editviewdef s.php and modify as you need:
    PHP Code:
            'includes' => 
             array (
               
    => 
               array (
                 
    'file' => 'modules/Accounts/Account.js'// can be any path/file, it's up to you
               
    ),
             ), 
    What do you think the cookie monster eats ?

Page 1 of 4 1234 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. upgraded to 4.5.1e, received "Metadata for table tracker does not exist"
    By sfgeorge in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2007-09-03, 02:24 PM
  2. problemi step 6 di SugarSuite-Full-4.0.1h
    By lucia in forum Italiano
    Replies: 0
    Last Post: 2006-12-27, 08:50 AM
  3. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  4. Replies: 7
    Last Post: 2006-06-06, 07:56 PM
  5. 4.0.1 Installation Problem
    By clawton in forum Help
    Replies: 14
    Last Post: 2006-02-13, 04:17 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
  •