M
M
Mikha Pankratov2016-02-25 16:55:27
Yii
Mikha Pankratov, 2016-02-25 16:55:27

How to correctly specify action in kartik-v/yii2-editable?

Good afternoon,
I don’t understand what I’m doing wrong)
Here is my form

<?php $form = ActiveForm::begin([
                        'id' => 'my-form-id',
                        'method' => 'POST',
//пробую тут указать экшен
                    ]); ?>

                        <?php
                            echo Editable::widget([
                                'model' => $model,
                                'attribute' => 'description',
                                'asPopover' => false,
                                'format' => Editable::FORMAT_LINK,
                                'inputType' => Editable::INPUT_TEXTAREA,
                                'inlineSettings' => [
                                    'templateAfter' =>  Editable::INLINE_AFTER_2,
                                ],
                                'formOptions' => [
//пробую так указывать экшен
                                    'action' => 'dass/ind',
                                ],
                                'editableValueOptions'=>['class'=>'text-info'],
                                'options' => ['class'=>'form-control', 'rows'=>2, 'cols' => 80, 'placeholder'=>'Enter notes...'],
                            ]);

But for some reason, it constantly leads me to the root, and even at the root I cannot get data from the form.
Here is my controller
public function actionIndex() {
    $model = new DD();;
    if (isset($_POST['hasEditable'])) {
      \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;

      if ($model->load(\Yii::$app->response->post())) {

And that's what the browser - answers

Request URL: site/myController/index
Request Method:GET
Status Code:200 OK
Remote Address:127.0.0.1:80
Response Headers
view source
Cache-Control:no-store, no-cache, must-revalidate, post-check=0 , pre-check=0
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:3348
Content-Type:text/html; charset=UTF-8
Date:Thu, 25 Feb 2016 14:16:07 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=5, max=100
Pragma:no-cache
Server:Apache /2.4.7 (Ubuntu)
Set-Cookie: _identity = 2d1f43342912bdaf5b7c33440a449d4a9add4c816f15fb7c019956498dd77807a% 3A2% 3A% 7Bi% 3A0% 3Bs% 3A9% 3A% 22_identity% 22% 3Bi% 3A1% 3Bs% 3A50 % 3A% 22% 5B% 22736% 22% 2C% 22Glcht4AzgaFqp00yQMKz13cFhiMCZvtD% 22% 2C2592000%5D%22%3B%7D; expires=Sat, 26-Mar-2016 14:16:07 GMT; Max Age=2592000; path=/; httponly
Vary:Accept-Encoding
X-Powered-By:PHP/5.5.9-1ubuntu4.14
Request Headers
view source
Accept:application/json, text/javascript, */*; q=0.01
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,ru;q=0.6
Connection:keep-alive
Cookie: _csrf = 67c98ba8644a0e588fff270afe7a9779d7f9d20a926b48c798cf2696e7ea4b3ea% 3A2% 3A% 7Bi% 3A0% 3Bs% 3A5% 3A% 22_csrf% 22% 3Bi% 3A1% 3Bs% 3A32 % 3A% 22ZCZWbKx47KWevFg-VftcdOZQ3TzkO0BD% 22% 3B% 7D; PHPSESSID=p5eonjnsuou0bq75mktbf2rm11; _identity = 2d1f43342912bdaf5b7c33440a449d4a9add4c816f15fb7c019956498dd77807a% 3A2% 3A% 7Bi% 3A0% 3Bs% 3A9% 3A% 22_identity% 22% 3Bi% 3A1% 3Bs% 3A50 % 3A% 22% 5B% 22736% 22% 2C% 22Glcht4AzgaFqp00yQMKz13cFhiMCZvtD% 22% 2C2592000% 5D% 22%3B%7D
Host: myhost
Referer: site/myController/index
User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/47.0.2526.73 Chrome/47.0.2526.73 Safari/ 537.36
X-CSRF-Token:RC04Z1liWHIebmIwOykgRnNmbwIvJD9fEktMBD0tAiN3eUIMFlIaNg==
X-Requested-With:XMLHttpRequest

Can anyone come across? What is this movie?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mikha Pankratov, 2016-02-26
@frmax

Widget has its own form, it conflicts with mine. Thanks to all who responded)

D
Dmitry Voronkov, 2016-02-25
@DmitryVoronkov

It seems to be - controller / action
Use the farbug to see which link the widget generates

D
Dmitry, 2016-02-25
@2fox

'formOptions' => [
          'action' => yii\helpers\Url::toRoute('/dass/ind'),
]

'formOptions' => [
          'action' => yii\helpers\Url::toRoute('dass/ind'),
]

???

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question