I'm still grasping Yii framework at the moment and I'm trying to submit a form to go to a specific controller in Yii. What I did was I used a CMSActive Form widget(correct me if I'm wrong)
and the code that I placed:
<?php $form=$this->beginWidget('CMSActiveForm', array(
'id'=>'file-form',
'action' => '../controllers/FolderController/actionCreate',
'enableAjaxValidation'=>false,
)); ?>
I'm trying to call the actionCreate function which is from another controller, so I'm trying to call it but the error 404 that says:
Unable to resolve the request "files/controllers/FolderController/actionCreate".
C:\\xampp1.8\\htdocs\\yii_1.1.13\\framework\\web\\CWebApplication.php
line # 286
0 C:\\xampp1.8\\htdocs\\yii_1.1.13\\framework\\web\\CWebApplication.php(141): CWebApplication->runController('files/controllers/FolderController') 1 C:\\xampp1.8\\htdocs\\yii_1.1.13\\framework\\base\\CApplication.php(169): CWebApplication->processRequest() 2 C:\\xampp1.8\\htdocs\\cubecms\\backend\\www\\index.php(12): CApplication->run() 3 {main}
I'm thinking that it could not see the function since it's an error 404, but am I calling it correctly?
My controller has an actionCreate function, and I'm good once I can get inside the function.
Place
$this-> createUrl ('/controller/action');
All url must be made using createUrl or createAbsoluteUrl method.
Here it is in fact url and need not to be /controller/action
If you want it to be submitted on /foo only then place '/foo' in createUrl
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.