yii editable url is adding google analytic before main url - yii

I am using below code to display editable field in my view page. Display looks good. However, when I click on save, its not going to general controller index action. If I see network, request url has google analytic domain before the domain I have set. Any reason to this?
$this->widget('editable.Editable', array(
'type' => 'text',
'name' => 'user_name',
'encode' => false,
'text' => 'John',
'url' => 'general/index',
'title' => 'Enter Name',
'placement' => 'right'
));
Also I am getting js error
Uncaught TypeError: Cannot read property 'editableSuccess' of undefined

Related

Yii2 - Multiple Dropzone Widget doesn't work

I'm working with Yii2 to develop an intranet portal.
I have to put multiple widget in same page but it doesn't work.
Give me this error
Dropzone already attached.
And my code is
...
<?= \kato\DropZone::widget([
'id' => 'dzImages',
'dropzoneContainer' => 'dzImages',
'options' => [
'url' => 'index.php?r=orders/upload&uid='.$model->ref,
'maxFilesize' => '10',
'acceptedFiles' => "image/*",
],
]); ?>
</p>
<p>
<?php echo \kato\DropZone::widget([
'id' => 'dzPDF',
'dropzoneContainer' => 'dzPDF',
'options' => [
'url' => 'index.php?r=orders/uploadpdf&uid='.$model->ref,
'maxFilesize' => '10',
'acceptedFiles' => ".pdf",
],
]);
?>
</p>
...
How can i resolve it?
Looking at the code of the widget, the 'id' parameter seems to be used differently than one would expect, instead you should probably set previewsContainer property too.
The ID parameter seems to be used as a JavaScript variable here:
https://github.com/perminder-klair/yii2-dropzone/blob/41e8145d940cc9955011138a9f16ad80e9831423/DropZone.php#L75

How to create a ZF2 FormCollection of the Doctrine ORM Module's ObjectSelect elements?

I have an odd situation where my add form works perfectly, but the edit form will not even load. Instead I get the following error:
Notice: Undefined property: DoctrineModule\Form\Element\ObjectSelect::$object in /vendor/zendframework/zendframework/library/Zend/Form/Element/Collection.php on line 517
Fatal error: Class name must be a valid object or a string in /vendor/zendframework/zendframework/library/Zend/Form/Element/Collection.php on line 517
I have objects of the class Application\Model\Record which have a many-to-many relationship to objects of the class Application\Model\Subject. I want the Subjects to appear as dropdowns in the Record forms, with the option to add multiple Subjects. So in the RecordFieldset.php I have:
$this->add(array(
'name' => 'subjects',
'type' => 'Zend\Form\Element\Collection',
'options' => array(
'label' => 'Subjects',
'count' => 1,
'should_create_template' => true,
'allow_add' => true,
'allow_remove' => true,
'template_placeholder' => '__subjectindex__',
'target_element' => array (
'name' => 'subject',
'type' => 'DoctrineModule\Form\Element\ObjectSelect',
'options' => array(
'object_manager' => $this->objectManager,
'target_class' => 'Application\Model\Subject',
'property' => 'name',
'empty_option' => 'Select a subject',
),
'attributes' => array(
'class' => 'form-control',
),
),
),
));
And like I said, this works perfectly in the Record add form. But it looks like on the edit form it cannot load the Subjects. Has anyone else tried something like this? Or do you have an idea what the error is saying?
Environment:
Zend Framework 2.3.3
Doctrine-orm-module 0.8.0
Doctrine 2.4.2
Looks like this is a bug on ZF2, target elements need to be a fieldset for it to work otherwise it will run into this issue. Use a fieldset to wrap the ObjectSelect.

How to edit column in CGridView

How is it possible, to make the columns in CGridView editable? i searched and find several extensions, but nothing works for me.
i'm doing something wrong or the extensions are buggy, i don't know.
can anyone help me please, and describe exactly, what i have to do, to make my columns in CGridView editable?
Yii-booster extension has class TbEditableColumn that implements column edit feature. You can look example here. There is my example of code:
array(
'class' => 'YbEditableColumn',
'name' => 'priority',
'value' => '$data->priorityName',
'sortable' => false,
'editable' => array(
'type' => 'select',
'source' => Task::model()->getPriorities(),
'url' => $this->createUrl('update'),
'placement' => 'top',
)
),
There is other extensions based on bootstrap Editable, like this, may be you can check it too.

CClientScript duplicates the output

I'm trying to use this extension in a partial view, in my registration module...
$form->widget('ext.tokenInput.TokenInput', array(
'model' => $model,
'attribute' => 'tags',
'url' => array('wizard/search'),
'options' => array(
'allowCreation' => false,
'preventDuplicates' => true,
'allowFreeTagging' => false,
'minChars' => 2,
'theme' => 'facebook',
)
));
...and assets (javascript and CSS files) are duplicated.
Basically I can see in the HTML code multiple occurrences of these files.
I have the same problem if I try to add custom JS files in the same partial view.
I specify POS_HEAD and I can see the code in <head> and in the middle of the page.
Why CClientScript duplicates assets if I add them in a partial view?
Thanks a lot!

Kohana Route to index action

I have a problem.
I have code:
Route::set('user', '(<controller>(/<id>))')
->defaults(array(
'controller' => 'user',
'id' => '\d+',
));
And mydomain.com/user/1 don't work..
Error:
The requested URL user/1 was not found on this server.
But when I set the dot between controller and id (or something else):
Route::set('user', '(<controller>.abc(/<id>))')
->defaults(array(
'controller' => 'user',
'id' => '\d+',
));
The mydomain.com/user.abc/1 work.
Why? :(
Thanks!
You want to check if the id is numeric, right? Then putting it like this in defaults is not the wright way, as you can read in the 3.3 documentation
Route::set('user', '(<controller>(/<id>))',
array(
'id' => '\d+',
))
->defaults(array(
'controller' => 'user',
'action' => 'index',
));
Also it is important where you define that route if you have more than just one. You have to provide an action (doc) either in the route or as default