CA Service Management

 View Only
  • 1.  onChange field not displaying value until manually selected

    Posted May 20, 2024 06:41 AM

    The next in the series of newbie questions from me:

    I am trying to populate an approver field in my Catalog request form that I am designing. The field (manager_ad) which must contain only the userid  which will be passed to the Approval policy.

    I am populating this field by doing an onChange - $(ca_fd.formId,'manager_ad').value(ca_fdGetSelection(ca_fd.formId,'userid').label) from the previous field which contains the alias|userid -  which then passes the correct userid to the manager_ad field. However, the manager_ad field does not display the userid value until the user clicks the field and selects the userid value that pops up underneath the field. How do i get the userid to be filled in without the user having to select it?

  • 2.  RE: onChange field not displaying value until manually selected
    Best Answer

    Broadcom Employee
    Posted May 21, 2024 01:51 AM

    Hi Patrick,

    We strongly recommend using only form field APIs available to avoid such unintended behaviors, do not directly update the fields.

    There are two ways to achieve your desired functionality, 

    1) By using the auto populate capability of Select and Lookup fields.

    Modify your report query to have third field as below

    Fields: alias,userid,manager_id

    Query: SELECT alias,userid, userid as manager_id FROM ca_contact

    select field will auto populate your text field by matching the text field id (manager_id) with the fields from report query.

    2) By using the onchange attribute of select field.

    onChange: ca_fdSetTextFieldValue(ca_fd.formId,'manager_id',ca_fdGetSelections(ca_fd.formId,'userid')[0].label)


    Satya Kiran

  • 3.  RE: onChange field not displaying value until manually selected

    Posted May 22, 2024 02:58 AM

    Thank you Satya. As always your recommendations are correct and very much appreciated.

    I implemented your second option of using the onChange attribute and it worked perfectly.

    Thank you,


  • 4.  RE: onChange field not displaying value until manually selected

    Posted May 22, 2024 05:01 PM
    Edited by Jason McClellan May 23, 2024 05:55 PM
    It sounds like you're trying to automatically populate the "manager_ad" field in your Catalog request form based on the value selected in another field ("userid") without requiring the user to manually select it again. Here are a couple of approaches you can try to achieve this:
    1. **Using JavaScript onChange Event**: Instead of just setting the value of the "manager_ad" field, you can also trigger a change event on that field after setting its value. This will notify the form that the field's value has changed and update its display accordingly. Here's an example of how you can modify your code:
    By firing the "change" event after setting the value, the "manager_ad" field should update its display to show the populated value without requiring the user to interact with it again. AFC Urgent Care
    2. **Using JavaScript to Directly Set the Field's Value**: Instead of relying on user interaction to select the value, you can directly set the value of the "manager_ad" field using JavaScript. If you already have the userid available, you can set it directly without needing to interact with the "userid" field. Here's an example:
    Replace "userid_value_here" with the actual userid value that you want to populate into the "manager_ad" field. This will immediately populate the field with the specified userid without requiring any additional user interaction.
    Try one of these approaches and see if it resolves the issue of the "manager_ad" field not displaying the userid value automatically. Depending on your specific form setup and requirements, one of these methods should work for you.