Customizing Form Functions

A form function is a type of function that resides in the form handler function that Siebel CRM Desktop uses for the object. It is specific to the form that contains the object. You can use a form function to validate user entry or to add business logic, such as to enter information in a hidden field, create a link, and so on. For more information, see Functions That You Must Not Modify.

To customize form functions

  1. Use a JavaScript editor to open the forms.js file.

  2. Locate the following section:

    //FORM FUNCTIONS
    
  3. Add the form functions that your customization requires to the section that you located.

    To view example form functions that do validations, see Example of Creating a Custom Validation.

Using Regular Expressions in Form Functions

To use a regular expression in a form function, you use a variable that contains the filtering criteria and a string that Siebel CRM Desktop must examine. You use the following format:

function function_name()
{
var fields = form.item.snapshot;
var filter = regular_expression
return filter.test(fields['field_name']);
}

where:

  • function_name identifies the name of your custom function.

  • regular_expression contains a string. You use two forward slashes (//) to indicate this regular expression.

  • field_name identifies the field that contains the string that you define in the regular expression.

For example, the following example uses a regular expression to make sure the user enters a value of manager in the Job Title field:

function validate_job_title()
{
var fields = form.item.snapshot;
var filter = /manager/g
return filter.test(fields['Job Title']);
}