function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yuen Lye KonYuen Lye Kon 

Programatically fire onchange for lightning inputfield

Is there a way to manually fire lightning inputfield (which is a picklist) onChange event via Lightning JS controller?
Manoj ThangavelManoj Thangavel
Hi Yuen,

Ideally the onchange event should work for <lightning:inputField />

If not, you can try with force:inputfield.....or lightning:select.

Thanks,
Manoj T
Yuen Lye KonYuen Lye Kon

The reason why I need a way to manually trigger picklist onchange event via JS controller is to refresh the list of dependent picklist values. I have a scenario whereby by two picklist

Picklist 1 (Solution Type):
Solution
FAQ
Knowledge Article

Picklist 2 (Organization):
A
B
C

Dependent Picklist (Category)
General Inquiry
Technical Issues
Troubleshooting
Product Quality
Software Usage
Getting Started
Order Status
Account


Since dependent picklist cannot have more than one controlling field, I had to create another picklist that act as a controlling field that looks something like this.

Picklist 3 (Controlling Field)
Solution A
Solution B
Solution C
FAQ A
FAQ B
FAQ C
Knowledge Article A
Knowledge Article B
Knowledge Article C

This controlling field picklist is to be hidden so that if either picklist 1 or picklist 2 is selected, it will change the selected index of picklist 3 which in turn will populate the correct values in dependent picklist based on the selected index of picklist 3. Therefore I need a way programatically to change the selected index of picklist 3 based on the value passed