Adding a custom datatype (for Javascript and CSS)

I’m new to SuiteCRM, but not at all new to software development and modifying content management systems. I have read a lot of documentation but there has been nothing that directly identifies the solution clearly. I hope you guys can help!

I’d like to have a form inside SuiteCRM where I can add js validation and possibly additional css for styling for certain fields in this form. I’ve seen in the past you can add the {literal} code {/literal} wrapped around the javascript to prevent it from being modified with htmlentities.

I’m thinking I need to create a custom data type that is a TextField, but I’m not so sure how to use it.

Can you help?

if you follow the instructions from this link:

http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.9/User_Interface/Fields/Creating_Custom_Fields/#Adding_the_Field_Type_to_Studio

It will information you how to create a custom field. Then all you need to do is add the field to a module in studio.

You can create a css and javascript file in the folder location for your custom field and then reference them in your smarty template. You can use the metadata viewdef files to include the javascript in

To add custom validation You need to add a custom validation function in javascript:

addToValidateCallback(
      'EditView', // Form Name / id
      'to_addrs_names',  // field name
      'email', // Field type
      true, // Is required
      SUGAR.language.translate('Emails', 'ERR_INVALID_REQUIRED_FIELDS'), // Message
      function() { // Callback
        var is_valid = false;
        return is_valid;
      }
 );