Results 1 to 9 of 9

Thread: Making a field read only - editview

  1. #1
    dusker is offline Senior Member
    Join Date
    Nov 2008
    Posts
    31

    Default Making a field read only - editview

    Hi,

    i'm running on sugar 5.1..0a, and i'd like to make the amount field readonly - there's a default value i'm assigning to it by a custom vardef file, and need to make this field readonly so noone can change it. can anyone give me a clue where to look for the place to edit it?
    usually it'd be adding an a property to form text item - readonly="readonly" right?

    thanks in advance for help

    greetings
    peter

  2. #2
    jsagar's Avatar
    jsagar is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    Ahmedabad,India
    Posts
    242

    Default Re: Making a field read only - editview

    hi
    you can write in custom/modules/metadata/editiviewdefs.php
    for that particular fields.
    it will be readonly
    'displayParams' =>
    array('readOnly' => true),

    ),


    you need to clear the cache
    Best Regards
    ---------------------------------------
    Jaydeepsinh Sagar

  3. #3
    dusker is offline Senior Member
    Join Date
    Nov 2008
    Posts
    31

    Default Re: Making a field read only - editview

    i've put in to the file You're talking about the following

    PHP Code:
     array( 'name'=>'amount','displayParams'=>array('readOnly'=>true)), 
    cleared cache and still the field is not readonly

  4. #4
    sugarcane is offline Sugar Community Member
    Join Date
    Apr 2005
    Location
    Chicago, IL
    Posts
    1,207

    Default Re: Making a field read only - editview

    Hello Peter,

    one easy way to do this is to remove the field from the edit view and just have it appear in the detail view.
    Intelestream has a great deal of experience hosting and customizing the SugarCRM application. Our company is made up by former employees of SugarCRM, and together we have over 50 years of experience working with the application. To learn more about us, please visit our website at www.intelestream.net or contact us directly at 800-391-4055 or by email at info@intelestream.net

  5. #5
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: Making a field read only - editview

    Try

    array (
    'name' => 'jobno',
    'label' => 'LBL_JOBNO',
    'type' => 'readonly',
    ),
    Mike Solomon
    Development Manager
    Ivy Ltd
    www.ivy.ltd.uk]www.ivy.ltd.uk

    php version 5.2.6
    MySql 5.1.59

  6. #6
    ckd1987 is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    88

    Default Re: Making a field read only - editview

    greetings... i use sugar 5.2e and its still not working I have a checkbox in Leads,

    1 =>
    array (
    'name' => 'nb_grund_c',
    'label' => 'LBL_NB_GRUND_C',
    'type' => 'readonly',
    ),
    ),

    and nothing is happen, normal users can change the value of the checkbox.... somebody know to help me?

    thx. greetings alex

  7. #7
    ishaan is offline Senior Member
    Join Date
    Apr 2009
    Location
    Mumbai,India
    Posts
    100

    Default Re: Making a field read only - editview

    Hi,

    One option can be by writing javascript code in view.edit.php , to disable a particular field.


    Cheers,
    Ishaan

  8. #8
    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: Making a field read only - editview

    Quote Originally Posted by ckd1987 View Post
    greetings... i use sugar 5.2e and its still not working I have a checkbox in Leads,

    1 =>
    array (
    'name' => 'nb_grund_c',
    'label' => 'LBL_NB_GRUND_C',
    'type' => 'readonly',
    ),
    ),

    and nothing is happen, normal users can change the value of the checkbox.... somebody know to help me?

    thx. greetings alex
    Modifying the type of this checkbox field to readonly should make it display as either "1" or "0". It is not the better approach, but it should works if you repaired the template cache (Admin -> Repair -> Quick Repair and Rebuild)
    I had filed a new feature which accomplish your needs: 27809 Improve Bool template field customization.
    A good work around, to avoid modify a core script, is to set a customCode for the field.

    Kind regards
    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.

  9. #9
    Rich2 is offline Senior Member
    Join Date
    Dec 2008
    Location
    Michigan
    Posts
    35

    Default Re: Making a field read only - editview

    'type' => 'readonly',
    Works great. Thanks Andre!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to set a field to read only
    By npolite in forum Help
    Replies: 9
    Last Post: 2009-07-08, 01:52 PM
  2. how to make a related field read only
    By uou in forum Developer Help
    Replies: 3
    Last Post: 2008-08-06, 06:35 AM
  3. Replies: 3
    Last Post: 2008-04-20, 01:13 PM
  4. Replies: 7
    Last Post: 2007-07-13, 01:38 PM
  5. How to make a field read only based on data
    By prismainc in forum Help
    Replies: 0
    Last Post: 2006-06-11, 01:07 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
  •