Results 1 to 6 of 6

Thread: Make required field in company in Sugar 5.0 RC

  1. #1
    john30043 is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Atlanta, GA
    Posts
    17

    Default Make required field in company in Sugar 5.0 RC

    I built a custom module that is based on 'Company'. Would like to make the "billing street address' a required field (I understand it will make all child modules like accounts use that restriction, but that's ok), so I went into include/SugarObjects/templates/company/vardefs.php and added line
    'required' => true,
    to the 'billing_address_street' field, then 'repair' database, the address still does not show red asterisk on the field, am I missing something?

  2. #2
    john30043 is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Atlanta, GA
    Posts
    17

    Default Re: Make required field in company in Sugar 5.0 RC

    I also cleared the cache, the application did check against the bill-to address when empty address is saved so it's somewhat working. The "Billing Address" label, however, still don't have the read asterisk indicator beside it. Where is the logic to enforce the red asterisk indicator? can anyone help?

  3. #3
    GameboyRMH is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    70

    Default Re: Make required field in company in Sugar 5.0 RC

    What version are you using? It works okay for me in 5 beta 2 and 5 RC.

    Anyhow try this:

    Go to custom/modulebuilder/packages/<packagename>/modules/<modulename> and look at the vardefs.php in there. This is the vardefs for modules in the Modulebuilder. When you deploy a module, everything about the fields is defined from this vardefs file.

    The fields you set as required should contain the line

    'required' => '1',

    Do you see it there? If not add the line and try re-deploying your custom module. Editing your module before it's deployed is far easier.
    Server: Fedora
    Sugar 5 CE
    Apache 2.2.6
    MySQL 5.0.27

  4. #4
    john30043 is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Atlanta, GA
    Posts
    17

    Default Re: Make required field in company in Sugar 5.0 RC

    I am using 5RC as the header indicated.

    the module I built is based on 'Company' model, so when I go to vardefs.php as you mentioned, "billing_street_address' will not show up there since the field is inherited from the 'company' parent object...

    The rest of the custom fields showed red asterisk correctly, but not inherited fields like 'billing_street_address', 'billing_city' etc...

    Server: WinXP
    Sugar v5.0.0 RC
    Apache 2.2.5
    MySQL 5.0.45
    ----------------------------

    Quote Originally Posted by GameboyRMH
    What version are you using? It works okay for me in 5 beta 2 and 5 RC.

    Anyhow try this:

    Go to custom/modulebuilder/packages/<packagename>/modules/<modulename> and look at the vardefs.php in there. This is the vardefs for modules in the Modulebuilder. When you deploy a module, everything about the fields is defined from this vardefs file.

    The fields you set as required should contain the line

    'required' => '1',

    Do you see it there? If not add the line and try re-deploying your custom module. Editing your module before it's deployed is far easier.
    Last edited by john30043; 2007-12-04 at 03:17 PM.

  5. #5
    GameboyRMH is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    70

    Default Re: Make required field in company in Sugar 5.0 RC

    Oh I was in a big rush earlier, doh!

    Try these instructions here:
    http://www.sugarcrm.com/forums/showthread.php?p=91792

    Use it to override the billing_address_street field. End the line with

    [required] = 1;

    or if that doesn't work, try with single quotes around the 1.
    Server: Fedora
    Sugar 5 CE
    Apache 2.2.6
    MySQL 5.0.27

  6. #6
    john30043 is offline Sugar Community Member
    Join Date
    Nov 2007
    Location
    Atlanta, GA
    Posts
    17

    Default Re: Make required field in company in Sugar 5.0 RC

    It did not work. the application did treat it as the required field as the field becomes red if empty address is entered, but still does not show up with the red asterisk beside the label. it doesn't matter whether I set it as 1,'1' or true for the $dictionary["MyModule"]["fields"]["billing_address_street"]["required"]=1.

    It does make sense to override at the custom directory as oppose to modifying directly at the include directory so it will be upgrade safe down the road.
    John Zhang
    [Server: WinXP]
    [Sugar v5.0.0 GA]
    [Apache 2.2.5]
    [MySQL 5.0.45]

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Removing Required Field
    By tuser13 in forum Help
    Replies: 11
    Last Post: 2008-06-05, 06:01 AM
  2. Replies: 4
    Last Post: 2007-08-24, 10:17 AM
  3. Replies: 7
    Last Post: 2007-07-13, 01:38 PM
  4. Replies: 1
    Last Post: 2007-02-21, 06:32 PM
  5. Make Account Name a required field
    By MORAND in forum Developer Help
    Replies: 6
    Last Post: 2006-07-20, 09:52 AM

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
  •