Results 1 to 4 of 4
Like Tree5Likes
  • 1 Post By rafael.q.g@hotmail.com
  • 3 Post By andopes
  • 1 Post By jmertic

Thread: How to Add php code in label

  1. #1
    mittul's Avatar
    mittul is offline Sugar Community Member
    Join Date
    Aug 2011
    Posts
    84

    Question How to Add php code in label

    hello .. i m using sugar crm version 6.2.1 in my local wamp server using windows xp 3


    i have contact form and PURCHASE DATE Field as (Date) Type. where the user selecting a date in DD/MM/YYYY format ..

    now as soon as i fill out this contact form and then if il go to view this particular entry , i want to see the Label there showing the

    ---------------------------------------
    CUSTOMER SINCE : (here i want to show the number or Days (i.e. 256days , 1year and 3Days) ) or something
    ---------------------------------------

    i want to show this Result as per the PURCHASE DATE selection, if as an admin i update this PURCHASE DATE
    then automatically it will affect to CUSTOMER SINCE result as well ..

    but u know i dont have any idea .. how to do this ..

    can any sugar master help me how to do this .. pls help me ..

  2. #2
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: How to Add php code in label

    Using ajax is a possible way to do that.
    Basically you need to create a div or span tag in label's place with an unique id.
    Then your ajax function called on proper event should set the innerHTML attriute or your label tag.
    Chris_C likes this.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  3. #3
    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: How to Add php code in label

    The easiest way is to defined the attribute 'customLabel' in the give field definition.

    PHP Code:
    'customLabel' => 'Some text, it can be a language entry or a static label'
    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.

  4. #4
    jmertic is offline Sugar Community Manager
    Join Date
    Dec 2007
    Posts
    2,224

    Default Re: How to Add php code in label

    You could do this with Sugar Logic, try adding a custom field with a calculated value like this:

    PHP Code:
    concat(multiply(daysUntil($date_entered),-1)," days"
    Chris_C likes this.
    John Mertic
    Sugar Community Manager

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Postal Code/Zip Code formatting
    By ssxss in forum Developer Help
    Replies: 3
    Last Post: 2011-09-23, 06:35 AM
  2. Showing System Label NOT Display Label
    By banning in forum Help
    Replies: 6
    Last Post: 2011-09-19, 09:09 PM
  3. Custom code for panel label?
    By door3ahmed in forum Help
    Replies: 4
    Last Post: 2009-02-17, 03:02 PM
  4. Replies: 0
    Last Post: 2008-07-14, 04:40 PM
  5. Replies: 0
    Last Post: 2008-04-24, 07:22 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
  •