0

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.

2 Answers 2

0

action expects a route or a valid url and not a path to the action.

`action`=>array('/controller/action',...)
Sign up to request clarification or add additional context in comments.

2 Comments

how do I know the baseurl of the action so I would know where to start?
You should read through yiiframework.com/doc/guide/1.1/en/basics.controller to understand how controllers and actions relate to urls.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.