I am trying to build a component in Joomla 2.5
I have to 2 tabs Items and Categories
I have created 5 categories.What I want is whenever I create a new item I want all 5 categories to be selected
How do save all catid to that particular item.??
Whenever I select ]multiple=multiple in xml form, and Submit the form, catid is set to zero.
<field
name="catid"
multiple="multiple"
type="category">
<option value="0">JOPTION_SELECT_CATEGORY</option>
</field>
How do I achieve that?Secondly where is code to insert catid values in db.
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_xyz.edit.xyz.data', array());
if (empty($data))
{
$data = $this->getItem();
}
print_r($data);
return $data;
}
Can any help me???
Regards
Prashant