私は私のコントローラ(管理者)にこのコードを持っている:私が持っているモデルでは編集フォームに戻るには?
function save(){
$model = $this->getModel('mymodel');
if ($model->store($post)) {
$msg = JText::_('Yes!');
} else {
$msg = JText::_('Error :(');
}
$link = 'index.php?option=com_mycomponent&view=myview';
$this->setRedirect($link, $msg);
}
:
function store(){
$row =& $this->getTable();
$data = JRequest::get('post');
if(strlen($data['fl'])!=0){
return false;
}
[...]
そして、これは働いている - エラーメッセージを生成し、それは項目のリストビューに戻ります。入力したデータを編集ビューに表示したいどうやってするの?通常、このメソッド「loadFormData」の中にロードされている
JFactory::getApplication()->getUserState('com_mycomponent.edit.mymodel.data', array());
:その後、
if ($model->store($post)) {
$msg = JText::_('Yes!');
} else {
// stores the data in your session
$app->setUserState('com_mycomponent.edit.mymodel.data', $validData);
// Redirect to the edit view
$msg = JText::_('Error :(');
$this->setError('Save failed', $model->getError()));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_mycomponent&view=myview&id=XX'), false));
}
は、あなたのようなものとのセッションからのデータをロードする必要がありますすることができますあなたのコントローラで