CA Service Management

 View Only
  • 1.  Validate spinner field in form is not working as expected

    Posted Nov 20, 2018 10:58 AM

    Validation of a spinner field in form is not working as expected. In catalog, the validation function only works correctly when the field value is changed manually in the text box, and does not work when the attached arrows of the spinner field are used or the form is submitted.


    The function is configured in the onValidate attribute of the field with the call ca_fd.js.validate(_val), and the function code is written in the script dialog.


      console.log('Validate field '+value);   
      var ip_free = parseInt(ca_fdGetTextFieldValue(formId,'ip_free'),10); 
      var ip_add = parseInt(value,10); 
      if(ip_add > ip_free){   
        return 'Validation failed';  
        return null; 

    Is it a bug or has the field changed its behavior?

  • 2.  Re: Validate spinner field in form is not working as expected

    Broadcom Employee
    Posted Nov 21, 2018 03:27 AM

    Good Morning Vinicius.

    Could this be of help for you?
    Occurs when the associated code verifies a field value against business rules before one of the following actions occurs:
    - The field value is stored in the data buffer.
    - The field value is written to the database.

    For example, the user tabs to or clicks a Serial Number field that must start with the letters SN and contain 10 numeric digits.
    Before the user can tab to the next field or click away from the field,
    the onValidate event and its associated code verify the data.
    You can alert the user if the serial number does not meet validation rules so they can adjust their entry.
    You can use onValidate for custom validation of the field input.
    For example, to ensure that a field input is at least three characters in length,
    you can write a custom function in the Script dialog:

    validateValue:function(_val) {
    if(_val.length < 3) {
    return "Please enter more than 3 characters for this field";
    } else {
    return null;

    In the Form Designer, include the onValidate attribute value for the text field on which to run the validation.
    For example:

    The custom function replaces the required parameter _val with the correct field value when the script runs.
    If the validation script returns a null value, the field input passes validation.
    Otherwise, the field input fails validation and the script returns an error
    (for example, "Enter more than 3 characters for this field").

    Kind regards, Louis van Amelsfort.

  • 3.  Re: Validate spinner field in form is not working as expected

    Posted Nov 21, 2018 07:00 AM

    Hi Louis,


    Thank you for attention, but that is the question, when the user tabs to the next field or click away from the spinner field the validation function not occurs if the field value was changed by the attached arrows. Only if I click in the spinner field and change de value manually, then by tabbing to the next field the validation function works normally.


    In addittion, when the form is submitted the validation function not works and an error is displayed in the browser console:


    Error: x.replace is not a function

    The link that you posted is about Ca Process Automation and the problem in discussion is about the Ca Service Catalog, I dont know if the functionality is the same.