Results 1 to 9 of 9

Thread: Immediately calculated fields

  1. #1
    manolotri is offline Senior Member
    Join Date
    Apr 2009
    Posts
    44

    Exclamation Immediately calculated fields

    Hi, i'm a novice programmer on php and sugarcrm.
    i'm spanish too, so if my english is not very good i'll hope u undertand me.
    I just calculated an operation with 2 fields, and i save the result in another one.
    it works perfectly, but i'm sure that the operation between the fields have not to wait de save moment. it's to say, when i put a value on field 1 and field 2, the result is automatically put in field3 (without needed of save changes).
    I don't know how to program this, i don't know if it's php or javascript (i don't know anything about javascript).
    Please help me. what i have to do?
    Thanks

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

    Smile Re: Immediately calculated fields

    Hi,
    U can use Enhanced Studio for that .
    It provide datatype "Code" using this u can do this easily.
    Install its Demo version .
    Demo version is working only for Detailview & Listview.
    May this help u.
    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

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

    Thumbs up Re: Immediately calculated fields

    hi.....

    just c this link...
    may be help u
    http://www.sugarcrm.com/forums/showthread.php?t=46644


    just change the javascript... if u dont know anything about javascript than search the code on net
    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

  4. #4
    kenshiro is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Macerata - ITALY
    Posts
    421

    Default Re: Immediately calculated fields

    Quote Originally Posted by vishwasrao View Post
    Hi,
    U can use Enhanced Studio for that .
    It provide datatype "Code" using this u can do this easily.
    Install its Demo version .
    Demo version is working only for Detailview & Listview.
    May this help u.
    Well, EditView works in the DEMO too, but only in field modifying the field and not in field creating.

  5. #5
    manolotri is offline Senior Member
    Join Date
    Apr 2009
    Posts
    44

    Default Re: Immediately calculated fields

    Hi ! thank you for help, but it not answer my dubts :'(
    I'm trying to do editing editviewdefs.php file, it's so hard, i don't know where i have to include the .js file in editviewdefs.php. maybe the javascript code has to be in views/view.edit.php but always i make this file, edit view dissapear.
    where i have to call function which do the operation??? under definition of the second fields of the operation ??
    If i put the script text in customcode, edit view dissapear.can i put customcode in a fields if i haven't enhanced studio??
    please HELP !
    Thanks a lot
    Last edited by manolotri; 2009-04-16 at 03:43 PM.

  6. #6
    manolotri is offline Senior Member
    Join Date
    Apr 2009
    Posts
    44

    Exclamation Re: Immediately calculated fields

    Hi, i detail my problem:
    I add the following code at the end of file modules\Accounts\Accounts.js (witch is include at the beginning of file editviewdefs.php)

    function calculate(){
    var a1 = document.getelementbyid('num1_c').value;
    var a2 = document.getelementbyid('num2_c').value;
    var a3 = a1 + a2;
    document.getelementbyid('num3_c').value = a3;
    }

    I add the following code to file custom\modules\Accounts\metadata\editviewdefs.php

    array (
    0 =>
    array (
    'name' => 'num1_c',
    'label' => 'LBL_NUM1',
    ),
    1 =>
    array (
    'name' => 'num2_c',
    'label' => 'LBL_NUM2',
    'displayParams' =>
    array (
    'javascript' => '<onchange="calculate();" ',
    ),
    ),
    ),
    11 =>
    array (
    0 =>
    array (
    'name' => 'num3_c',
    'label' => 'LBL_NUM3',
    ),
    1 => NULL,
    ),

    Why it doesn't work ?!?!

    Thanks!

  7. #7
    manolotri is offline Senior Member
    Join Date
    Apr 2009
    Posts
    44

    Exclamation Re: Immediately calculated fields

    Can anyone help me plz?

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

    Thumbs up Re: Immediately calculated fields

    hi.......

    when changing this option any error it is giving to U???/

    may be ur function is not including so it may give u error link function is not define


    check it out... !
    Regards
    ==========================
    akkimca
    Work as Sugarcrm Freelancer
    Feel free to Find me in skype. Its my pleasure to talk with you.
    ID: akshay.biztech

  9. #9
    manolotri is offline Senior Member
    Join Date
    Apr 2009
    Posts
    44

    Exclamation Re: Immediately calculated fields

    OK that's the answer: http://www.sugarcrm.com/forums/showthread.php?t=46701

    i think it's useful !
    Last edited by manolotri; 2009-04-21 at 07:51 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Calculated fields in 5.0
    By salimmohd82 in forum Developer Help
    Replies: 9
    Last Post: 2012-01-24, 08:35 PM
  2. Calculated Fields and Constants
    By cygnusceo in forum Developer Tutorials
    Replies: 2
    Last Post: 2008-12-29, 03:15 PM
  3. Calculated Sum of 2 fields
    By kinshibuya in forum Help
    Replies: 14
    Last Post: 2008-11-04, 07:32 PM
  4. Creating Fields - calculated fields and 'related' field
    By gipps in forum General Discussion
    Replies: 0
    Last Post: 2007-07-21, 10: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
  •