Results 1 to 6 of 6

Thread: Disable Field

  1. #1
    andrei756 is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    34

    Default Disable Field

    Hi

    How can I set a field to disabled. The user shouldnt be able to change the information in that field. It should be able to display information though.

    Regards
    Andrei

  2. #2
    sts's Avatar
    sts
    sts is offline Sugar Community Member
    Join Date
    Aug 2010
    Posts
    978

    Default Re: Disable Field

    Stefan Ulrich Sauer
    System Analyst

    Devoteam Danet GmbH
    Gutenbergstraße 10
    D-64331 Weiterstadt
    Germany
    email: Stefan-Ulrich.Sauer@devoteam.com
    http://www.devoteam.de

  3. #3
    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: Disable Field

    You can edit the editviewdefs of your module, and the disabled field has to use the customCode attribute, making it display just the field value.
    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

  4. #4
    andrei756 is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    34

    Default Re: Disable Field

    I checked that thread but I am not quite sure if there is a solution to what I need.

    PHP Code:
    'FIELD_NAME' => array(
      
    'name' => 'FIELD_NAME',
      
    'customCode' => '
          {if $fields.SOME_FIELD.value}
              <input type="text" name="FIELD_NAME" value= "{$fields.FIELD_NAME.value}">
          {/else}
                {$fields.FIELD_NAME.value}
           {/if}
      '
    ), 
    I get the value for my field from a js file where I calculate the sum of some fields.

    I dont have the time to check the devtoolkit. Looks complicated.

    can you tell me what code needs to be put in the customCode attribute to display only the field value?

    Thanks

  5. #5
    sts's Avatar
    sts
    sts is offline Sugar Community Member
    Join Date
    Aug 2010
    Posts
    978

    Default Re: Disable Field

    PHP Code:
    'FIELD_NAME' => array(
      
    'name' => 'FIELD_NAME',
      
    'customCode' => '{$fields.FIELD_NAME.value}'
    ), 
    "FIELD_NAME" is the name of your field.
    Stefan Ulrich Sauer
    System Analyst

    Devoteam Danet GmbH
    Gutenbergstraße 10
    D-64331 Weiterstadt
    Germany
    email: Stefan-Ulrich.Sauer@devoteam.com
    http://www.devoteam.de

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

    Default Re: Disable Field

    Another somewhat more upgrade-safe way to do this is to specify the 'disabled' attribute for the field using the displayParams parameter as shown below:

    PHP Code:
    'FIELD_NAME' => array(
      
    'name' => 'FIELD_NAME',
      
    'displayParams' => array('disabled' => 'disabled'))
    ), 

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. disable a field conditionnally
    By clement in forum Developer Help
    Replies: 19
    Last Post: 2010-06-18, 11:55 PM
  2. Disable field
    By blitz2190 in forum Help
    Replies: 5
    Last Post: 2009-08-17, 01:44 PM
  3. Can we disable any field
    By nandynandy in forum Developer Help
    Replies: 11
    Last Post: 2008-05-01, 09:50 PM
  4. Replies: 0
    Last Post: 2007-04-25, 12:45 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
  •