English 中文(简体)
Joomla 2.5 保存多个选定列表吗?
原标题:joomla 2.5 saving multiple select lists?

我试图在我的后端组件中添加多个选择列表, 但我似乎无法让它发挥作用。 我尝试了搜索Joomla论坛,并尝试了他们的建议, 但仍无法奏效 。

以下是我所做的:

/模型/实地/类别。

foreach ($result as $item) {
    $options[] = JHtml::_( select.option , $item->id, $item->title);
};
$drawField  =   ;
$drawField .=  <select name=" .$this->name. " id=" .$this->name. " class="inputbox" size="10" multiple="multiple"> ;
$drawField .= JHtml::_( select.options , $options,  value ,  text , $strVal, true);
$drawField .=  </select> ;
return $drawField;

/模型/形式/编辑.xml

<field name="catid" type="categories" multiple="true" size="40" class="inputbox" label="COM_PRODUCTS_FORM_LBL_EDIT_CATID" description="COM_PRODUCTS_FORM_DESC_EDIT_CATID" required="true" filter="safehtml" />

/模型/编辑.php

protected function loadFormData()
{
    $data = JFactory::getApplication()->getUserState( com_products.edit.edit.data , array());
    if (empty($data)) {
        $data = $this->getItem();
        $data->catid = explode( , ,$data->catid);
    }
return $data;
}

/表/编辑.php

public function check() {
    if (property_exists($this,  ordering ) && $this->id == 0) {
        $this->ordering = self::getNextOrder();
    }
    $this->catid = implode( , ,$this->catid);   
return parent::check();
}

它在后端将野外目录保存为“ 阵列 ” 。 然而, 当我手工输入143,148作为野外值时, 它并没有突出那些字段, 所以显然我的内爆/ 爆炸没有起作用。 任何帮助都会受到欢迎!!! @ info: tooltip

谢谢:)

最佳回答

问题在于:在 xml 文件中过滤器= "safel html", 如果其他人对同样的事情有问题的话... 现在一切都很好了 :

问题回答

暂无回答




相关问题
cross platform issues in webpages

I am developing some basic html pages, i am setting colors of text usimg color code #e7eddf it seems fine in windows but seems different in mac. Can you explain me why its happening and also ...

How to create breadcumb for custom component in Joomla?

I have a custom component in which I want to have a breadcumb to help the user navigate the previous page visits. The basic feature in my component is to show our product releases. The workflow is: ...

Preloading images

i ve a navigation bar like the one below..for each it changes the background color on mouseover and mouseout and there is a lag to load those images which looks awful :( i wanna know how to preload ...

Joomla conditional menu item

I d like to create a menu item in Joomla that points to one article when the user is logged out, and a different article when the user is logged in. I tried creating two menu items, and make them ...

unable to connect to database on AWS

actually I have my website build with Joomla hosted on hostmonster but all Joomla website need a database support to run this database is on AWS configuration files need to be updated for that I ...

How can you test if you re on the homepage in Joomla?

I m working on a Joomla site, and I need the front page to look slightly different from the rest of the pages, but not enough to warrant the use of two themes (it s a pain to have to update two ...

How to get the current Joomla username?

I m trying to get the current Joomla username. I was able to get it by using $user =& JFactory::getUser(); echo $user->username; But now I ve installed Joomla on my local server and it doesn ...

热门标签