You need to use a <frontend_model>
, for which you can find some examples in the core (eg in app/code/core/Mage/Catalog/etc/system.xml
).
The frontend model must be a block inheriting from Mage_Adminhtml_Block_System_Config_Form_Field
, which has a _getElementHtml()
method where you can apply your own code to the form element before rendering it. Eg :
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->setOnclick('launchExample();');
$html = $element->getElementHtml();
$html .= '<script type="text/javascript">function launchExample(){ alert("This is an example"); }</script>';
return $html;
}