I need to populate a child dropdown list based on the selection made in the parent dropdown list for which AJAX is required. But I don't understand how I can add onClick events in jform where fields are defined in xml tags. I am using joomla 2.5.3 for your kind information.
Any help would be appreciated.
<field
name="fkclass"
type="text"
label="Class"
description=""
class="inputbox"
required="true">
<option value="">Select a Class</option>
</field>
You have to make your own field http://docs.joomla.org/Creating_a_custom_form_field_type. Then you have to load your javascript/AJAX code during the get input function.
For example I made my own nice looking color field which looks like:
This should help you getting started. In the javascript code you can then make a listener which is triggered when the parent dropdown changes it's value.