AJAX and onClick events for elements of jform in joomla -
I need to populate a child dropdown list based on the selection in the Parents dropdown list for which AJAX It is necessary but I do not understand how can I add an onClick event to jfm where the fields are defined in XML tags. I am using Joomla 2.5.3 for my kind of information.
Any help would be appreciated.
& lt; Field name = "fkclass" type = "text" label = "class" description = "" class = "inputback" required = "true" & gt; & Lt; Option value = "" & gt; Select a class & lt; / Option & gt; & Lt; / Region & gt;
You will need to create your own field after which you will get your input / function You must load your Javascript / AJAX code during For example, I have created my good looking color area that looks:
defined ('_JEXEC') or die (); Class JeffFormed Duplicate JFormFieldText {protected $ type = 'Dpcolor'; Public function getInput () {$ document = JFactory :: getDocument (); $ Document- & gt; AScript (JURI :: Root (). 'Admin / components / com_dpcalendar / library / jscolor / jscolor.js'); Return parent: getInput (); } Public function setup (SimpleXMlelement $ element, $ value, $ group = null) {$ element ['class'] = $ element ['class'] 'color' ($ Element ['required']? '': '{Required: wrong}'); $ Return = original :: setup ($ element, $ value, $ group); Return refund; }}
This should help you get started. In the Javascript code, you can then create a listener that is triggered when the original dropdown changes its value.
Comments
Post a Comment