I am trying to add new field in new article in frontend of joomla as described here: http://docs.joomla.org/Adding_custom_fields_to_the_article_component
But the fields are not shown on the form. Can anybody explain me the reason?
Below is my code written in plugin file:
function onContentPrepareForm($form, $data)
{
if (!($form instanceof JForm))
{
$this->_subject->setError('JERROR_NOT_A_FORM');
return false;
}
// Add the extra fields to the form.
// need a seperate directory for the installer not to consider the XML a package when "discovering"
JForm::addFormPath(dirname(__FILE__) . '/rating');
$form->loadFile('rating', false);
return true;
}
The one thing I observed is that, in my com_content folder inside component, the fixed code is written and that is the reason, why my fields are not visible. Is it ok if I change the file: \components\com_content\views\form\tmpl