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:
```javascript
$(ca_fd.formId,'manager_ad').value(ca_fdGetSelection(ca_fd.formId,'userid').label);
$(ca_fd.formId,'manager_ad').fireEvent("change");
```
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:
```javascript
$(ca_fd.formId,'manager_ad').value("userid_value_here");
```
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.
Original Message:
Sent: May 20, 2024 06:40 AM
From: Patrick_Price_10294
Subject: onChange field not displaying value until manually selected
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?