Making Sure Users Do Not Exceed the Maximum Number of Characters

You can use validation to make sure the user does not enter more than a maximum number of characters in a field.

To make sure users do not exceed the maximum number of characters

  1. Make sure the form_validator object is defined.

    For more information, see Preparing to Use Validation.

  2. Add the following code to the forms.js file:

    validator.validate_field_length(“field_name“,“control_Id“,“maximum_length“,“str
    ing_key“);
    

    where:

    • field_name identifies the name of the field that Siebel CRM Desktop must validate.

    • control_Id identifies the control that Siebel CRM Desktop uses for the field that it must validate.

    • maximum_length specifies the maximum length for the field in characters.

    • string_key is the string key in the resource file that contains the text for the message that Siebel CRM Desktop displays in the client if the validation fails.

    For example, the following code makes sure the user does not enter more than 1500 characters in the Comment field of an Activity:

    validator.validate_field_length("Comment","description",1500,"msg_activity_comm
    ents_validation");
    
  3. Test your changes and then republish the customization package.

    For more information, see Republishing Customization Packages.