2

I've just installed vova07 / yii2-imperavi-widget through php composer.phar require --prefer-dist vova07/yii2-imperavi-widget "*". And, it's working fine for inserting any content to database table. But, I'm in awkward situation when fetching data into this this widget

I want to fetch the data. So, I created one 'value' => $postDetails['desc']. Data Not Coming to it.

<?= $form->field($modelEditPost, 'desc')->widget(Widget::className(), [
  'settings' => [
            'value' => $postDetails['desc'],
            'lang' => 'ru','minHeight' => 200,'plugins' => ['clips','fullscreen']]
]);?>

But, when i'm including

<?= $form->field($modelEditPost, 'desc')->textarea(['rows' => 6,'value'=>$postDetails['desc']]) ?> 

(which was previously present to fetch data) along with widget, Data coming to widget (But, not in textarea))

<?= $form->field($modelEditPost, 'desc')->textarea(['rows' => 6,'value'=>$postDetails['desc']]) ?>

<?= $form->field($modelEditPost, 'desc')->widget(Widget::className(), [
  'settings' => [
            'value' => $postDetails['desc'],
            'lang' => 'ru','minHeight' => 200,'plugins' => ['clips','fullscreen']]
]);?>

Actually, I want data to be fetched into widget.

Please help me to rectify this issue.

Nana Partykar
  • 10,556
  • 10
  • 48
  • 77
  • Useful: http://www.yiiframework.com/doc-2.0/guide-input-tabular-input.html – Insane Skull Dec 11 '15 at 10:54
  • @InsaneSkull : Thanks for giving link. But, I don't have problem in inserting / fetching. Insertion is OK. Only fetching problem come when i dont't declare activeFrom textarea to it (which is not necessary at all) – Nana Partykar Dec 11 '15 at 10:56
  • i am not getting your question, elaborate more. – Insane Skull Dec 11 '15 at 11:03
  • Before I was using default active form textrea to display content. Now, requirement came to use any texteditor. So, i installed it. **Problem is :** value not coming to widget when i want to edit my content. It is only coming in widget when i'm using default active form textrea + that widget (as i showed in question). So, why value coming only when i am including textarea along with widget @InsaneSkull – Nana Partykar Dec 11 '15 at 11:10
  • pass id of textbox to widget. – Insane Skull Dec 11 '15 at 11:12
  • Now, value coming to textarea and not in widget. @InsaneSkull – Nana Partykar Dec 11 '15 at 11:17
  • show `$postDetails` array. – Insane Skull Dec 11 '15 at 11:19
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/97626/discussion-between-insane-skull-and-nana-partykar). – Insane Skull Dec 11 '15 at 11:20

1 Answers1

0

Use $modelEditPost->desc = $postDetails['desc']:

$modelEditPost->desc = $postDetails['desc'];
  <?= $form->field($modelEditPost, 'desc')->widget(Widget::className(), [
'settings' => ['lang' => 'ru','minHeight' => 200,'plugins' => ['clips','fullscreen']]
]);?>
Insane Skull
  • 9,220
  • 9
  • 44
  • 63