Sunday, 8 February 2015

joomla multiple custom fields using xml



I need to create some custom fields using xml in a module in joomla 3.0. I did somethething like this, shown below. my mod_mymodule.xml file code for fields is :



<fields name="params">
<fieldset name="protection" addfieldpath="/modules/mod_careercategory/include/" label="tagelement">
<field name="headerTitle" type="text" default="" label="HEADER_TITLE" description="HEADER_TITLE_DESC"/>
<field name="Title" type="myelem" label="TITLE" id="Title"/>
</fieldset>
</fields>



jimport('joomla.form.formfield');

class JFormFieldMyelem extends JFormField
{
protected $type = 'myelem'; //the form field type

protected function getInput()
{

return '<input type="text" name="'.$this->name.'" id="'.$this->id.'" label="Title"/><br />'.
'<input type="text" name="Link" id="Link" label="Link"/><br />'.
'<input type="text" name="Order" id="order" label="order"/><br />'.
'<input type="button" id="btnAdd" name="addmore" value="Add more">
<input type="button" id="btnDel" value="Remove" />';


}


How to load multiple fields? please help me


No comments:

Post a Comment