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

Thread: Create add email address field with custom code

  1. #1
    akkimca's Avatar
    akkimca is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    270

    Thumbs up Create add email address field with custom code

    Hi all,
    i create a add email address button which is useful to add the multiple email address on clicking on the add button... i also put cancel button near to text box which will clear new add email text

    so i show u steps how to create this
    1) create the one custom code field and give it proper name like email_add_c
    2) in code write following code
    PHP Code:
    echo "
    <script>
        function showemail()
        {
              var btn=document.getElementById('addbutton');
                btn.disabled='true';
            var x=document.getElementById('productLine').insertRow(-1);
            var dd=x.insertCell(0);
            dd.innerHTML='<div id=\'myTable\'><input type='text' id=\'emailtext\' name=\'emailtext\'><input type=\'button\' value=\'Cancel\' onclick=\'cancel(this)\'></div>';
            
        }
    function cancel(ln){
    var obj = ln.parentNode.parentNode.rowIndex;
        document.getElementById('productLine').deleteRow(obj);
     var btn=document.getElementById('addbutton');
                btn.disabled='';
    }
        
        </script>"

    3) just add this field in ur editview and detailview layout
    4) after adding this just open custom/module/{U r Module name}/metadata/editviewdef.php
    write this code after ur new added custom code field (email_add_c)
    PHP Code:
    => 
            array (
              
    => 
              array (
                
    'name' => 'new_email_c',
                
    'label' => 'LBL_PRE_CMT',
                
    'customCode' => '<input type=\'button\' value=\'Add Email\' onclick=\'showemail();\'><table width=\'100%\' border=\'0\' cellspacing=\'0\' cellpadding=\'0\' id=\'productLine\'></table>',
              ),
              
    => NULL,
            ), 
    i add this code because my enhanced studio not full version so it is not display add email button in the create form..
    5) rebuild the sugar

    i hope this code help u to add the multiple email, product, address etc..

    any query please ask me and if u have any suggestion than also let me know

    pls reply if its work for u
    Last edited by akkimca; 2009-04-23 at 10:28 AM.
    Regards
    ==========================
    akkimca
    Work as Sugarcrm Freelancer
    Feel free to Find me in skype. Its my pleasure to talk with you.
    ID: akshay.biztech

  2. #2
    2nox is offline Member
    Join Date
    Feb 2009
    Location
    Indonesia
    Posts
    17

    Default Re: Create add email address field with custom code

    i am interest about your thread. but before i do that. i can't create custom field by custom code. can you explain me about it.. thanks

  3. #3
    akkimca's Avatar
    akkimca is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    270

    Thumbs up Re: Create add email address field with custom code

    thanks for reply

    to used custom code u have to download enhanced studio of sugar...
    u can find it in sugar site..

    after downloading this u can get the code field in ur datatype. (studio/ur module/add field/data type)

    jst used my code that vl help u to create add email field

    feel free to ask d question

    al b best
    Regards
    ==========================
    akkimca
    Work as Sugarcrm Freelancer
    Feel free to Find me in skype. Its my pleasure to talk with you.
    ID: akshay.biztech

  4. #4
    2nox is offline Member
    Join Date
    Feb 2009
    Location
    Indonesia
    Posts
    17

    Default Re: Create add email address field with custom code

    hmmm.. what diferent between module studio in sugar ( admin -> studio ) with enhanced studio. can me create custom code for adding field in my extend modul without use enhanced studio..

    thansk before

  5. #5
    2nox is offline Member
    Join Date
    Feb 2009
    Location
    Indonesia
    Posts
    17

    Default Re: Create add email address field with custom code

    hi akkimca,

    i have tried your thread n i didn't change anything your code, but when i click the button i can't see action anything. so what the problem. i am sorry my english not very good

  6. #6
    vishwasrao's Avatar
    vishwasrao is offline A Prolific Poster
    Join Date
    Sep 2008
    Location
    Pune,Maharashtra,India
    Posts
    385

    Smile Re: Create add email address field with custom code

    hi Akshay,
    I tried your code but unfortunately nothing is hapening.Is anything i am missing?
    When i click on add email button nothing is happening.
    Vishwasrao Salunkhe
    vishwasrao.salunkhe@gmail.com
    Fan Of Sachin Tendulkar
    Operating System :- Windows XP
    PHP Version:- 5.3
    Apache :-2.2.11
    MYSQL :-5.1.36

  7. #7
    akkimca's Avatar
    akkimca is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    270

    Thumbs up Re: Create add email address field with custom code

    hi..

    can u check javascript error ????

    just check any javascript error is not cming in ur form

    just copy this code in custom/module/{U r Module name}/metadata/editviewdef.php
    PHP Code:
    => 
            array (
              
    => 
              array (
                
    'name' => 'new_email_c',
                
    'label' => 'LBL_PRE_CMT',
                
    'customCode' => '<input type=\'button\' value=\'Add Email\' onclick=\'showemail();\'><table width=\'100%\' border=\'0\' cellspacing=\'0\' cellpadding=\'0\' id=\'productLine\'></table>',
              ),
              
    => NULL,
            ), 

    all d best
    Regards
    ==========================
    akkimca
    Work as Sugarcrm Freelancer
    Feel free to Find me in skype. Its my pleasure to talk with you.
    ID: akshay.biztech

  8. #8
    leandro.souza is offline Member
    Join Date
    Apr 2009
    Posts
    11

    Default Re: Create add email address field with custom code

    Hi

    I wanna know how can i "rebuild the sugar"?

    Sorry, i´m newbie and i need to learn a lot...

  9. #9
    2nox is offline Member
    Join Date
    Feb 2009
    Location
    Indonesia
    Posts
    17

    Default Re: Create add email address field with custom code

    I already could add the text field after i clicked the button but i should change some code first. these are some codes that i already change:

    // var btn=document.getElementById('addbutton');
    // btn.disabled='true';
    but now i have another problem, i can't save the value of that text field, how can i solve this problem? thx for your help

  10. #10
    akkimca's Avatar
    akkimca is offline Sugar Community Member
    Join Date
    Dec 2008
    Posts
    270

    Thumbs up Re: Create add email address field with custom code

    hi...

    pls again copy the code and check..
    and rebuild the sugar...

    to save the this all field u have to write the logic hook for that...
    may b used after save logic hook and create the new table and stored the $bean->id and other field in that table.. $bean->id is used to fetch the data of that user in editview...

    all the best...
    Regards
    ==========================
    akkimca
    Work as Sugarcrm Freelancer
    Feel free to Find me in skype. Its my pleasure to talk with you.
    ID: akshay.biztech

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. Create a add email address field with custom code
    By akkimca in forum Developer Help
    Replies: 16
    Last Post: 2010-06-26, 11:25 AM
  2. custom function call from custom code field in metadata
    By josh.sweeney in forum Developer Help
    Replies: 9
    Last Post: 2010-02-09, 09:23 PM
  3. Create Custom Link using Address Information
    By infamousse in forum Developer Help
    Replies: 1
    Last Post: 2009-04-09, 05:41 AM
  4. Create Custom Link using Address Information
    By infamousse in forum Developer Tutorials
    Replies: 0
    Last Post: 2009-04-08, 08:41 AM
  5. Replies: 4
    Last Post: 2008-08-11, 04:46 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
  •