Closed buttflattery closed 5 years ago
Check the following:
btn-default
must exist in both old and new hashThen report. Cross check with the demos (it should work).
Thanks for the heads-up @kartik-v , I am using the default code for the extension and using the TreeView as a widget but yes I use custom form view, and I have checked everything that has been changed in the view.
But after your reply I noticed that you have Updated to release v1.1.1
so I ran the composer update
again and now the hash mismatch error is gone and a new issue rises, now it says
No Campaign Selected
as i have provided this text for the option emptyNodeMsg
in the TreeView::widget()
. If i copy paste the view provided by the extension it starts working correctly and as i switch back to my view it starts saying the same that No Campaign is Selected
?
The params sent with the request when we click on any node using my custom view is below
_csrf-backend XP8WbMRCOgoMDzwRfiv_wCxqZN1s2XWZ77DN1P_Q1Qo2yHku9hZzfFhZVSYMHZC5Qjgtgl_pQ96N0p-OnLOiMg==
allowNewRoots true
breadcrumbs[activeCss] active
breadcrumbs[depth]
breadcrumbs[glue] +»+
breadcrumbs[untitled] Untitled
currUrl /manage-campaigns
defaultBtnCss btn-default
formAction http://www.kp2.local/node/save
formOptions[id] w0-nodeform
iconsList none
id 1
isAdmin true
modelClass common\models\Campaign
multiple true
nodeAddlViews[1]
nodeAddlViews[2]
nodeAddlViews[3]
nodeAddlViews[4]
nodeAddlViews[5]
nodeSelected w0-nodesel
nodeTitle node
nodeTitlePlural nodes
nodeView @backend/views/campaign/_form
nodeViewButtonLabels[reset] <i+class="glyphicon+glyphicon-repeat"></i>
nodeViewButtonLabels[submit] <i+class="glyphicon+glyphicon-floppy-disk"></i>
noNodesMessage <div+class="kv-node-message">No+campaigns+selected</div>
parentKey
showFormButtons true
showIDAttribute false
showNameAttribute true
softDelete false
treeManageHash f9e73bba957add519b115217a89329c8a3453a9511ef740deb25fab1dda3bc06common\models\Campaignbtn-defaulthttp://www.kp2.local/node/save/manage-campaigns@backend/views/campaign/_formw0-nodeselnodenodes<div+class="kv-node-message">No+campaigns+selected</div>1111{"id":"w0-nodeform"}{"1":"","2":"","3":"","4":"","5":""}{"submit":"<i+class=\"glyphicon+glyphicon-floppy-disk\"></i>","reset":"<i+class=\"glyphicon+glyphicon-repeat\"></i>"}[]"none"{"activeCss":"active","depth":"","glue":"+»+","untitled":"Untitled"}
treeMoveHash 516f6ac42807bbf2cbcb5d3b241ff167c9e61a65513f8c8587f00b2ab1ff3e0bcommon\models\Campaign1
treeRemoveHash cf11aede2fe19714be923591dd67286e3c7eb5f7813e6aeb97e6240780465c67common\models\Campaign
and when using default view it shows below params that has the only difference in the _csrf-backend
_csrf-backend kSCVyTbryVEiTmVlDLwNcCUGe1OqowSzxYl2bJm-dvb7F_qLBL-AJ3YYDFJ-imIJS1QyDJmTMvSn6yQ2-t0Bzg==
allowNewRoots true
breadcrumbs[activeCss] active
breadcrumbs[depth]
breadcrumbs[glue] +»+
breadcrumbs[untitled] Untitled
currUrl /manage-campaigns
defaultBtnCss btn-default
formAction http://www.kp2.local/node/save
formOptions[id] w0-nodeform
iconsList none
id 1
isAdmin true
modelClass common\models\Campaign
multiple true
nodeAddlViews[1]
nodeAddlViews[2]
nodeAddlViews[3]
nodeAddlViews[4]
nodeAddlViews[5]
nodeSelected w0-nodesel
nodeTitle node
nodeTitlePlural nodes
nodeView @backend/views/campaign/_form
nodeViewButtonLabels[reset] <i+class="glyphicon+glyphicon-repeat"></i>
nodeViewButtonLabels[submit] <i+class="glyphicon+glyphicon-floppy-disk"></i>
noNodesMessage <div+class="kv-node-message">No+campaigns+selected</div>
parentKey
showFormButtons true
showIDAttribute false
showNameAttribute true
softDelete false
treeManageHash f9e73bba957add519b115217a89329c8a3453a9511ef740deb25fab1dda3bc06common\models\Campaignbtn-defaulthttp://www.kp2.local/node/save/manage-campaigns@backend/views/campaign/_formw0-nodeselnodenodes<div+class="kv-node-message">No+campaigns+selected</div>1111{"id":"w0-nodeform"}{"1":"","2":"","3":"","4":"","5":""}{"submit":"<i+class=\"glyphicon+glyphicon-floppy-disk\"></i>","reset":"<i+class=\"glyphicon+glyphicon-repeat\"></i>"}[]"none"{"activeCss":"active","depth":"","glue":"+»+","untitled":"Untitled"}
treeMoveHash 516f6ac42807bbf2cbcb5d3b241ff167c9e61a65513f8c8587f00b2ab1ff3e0bcommon\models\Campaign1
treeRemoveHash cf11aede2fe19714be923591dd67286e3c7eb5f7813e6aeb97e6240780465c67common\models\Campaign
The solution is to take the default view again and just embed your custom view components one by one (without changing the default hidden inputs and default conditions) to see where you have an error. This is because some conditions have changed in validating the params sent to the view.
Ok @kartik-v , let me do that again and I will get back to you, meanwhile, i noticed that there is a missing <?=
tag before the field inside the view on line 265
under SECTION 7
, before you call $form->field($node, $iconTypeAttribute)->dropdownList([
, see below
<?php if($iconsList === 'text'): ?>
<div class="row">
<div class="col-sm-4">
$form->field($node, $iconTypeAttribute)->dropdownList([
TreeView::ICON_CSS => 'CSS Suffix',
TreeView::ICON_RAW => 'Raw Markup',
], $inputOpts) ?>
</div>
<div class="col-sm-8">
<?= $form->field($node, $iconAttribute)->textInput($inputOpts) ?>
</div>
</div>
<?php endif; ?>
I recently updated composer and my
yii2-tree-manager
extension was updated from8ab3047 => 2e40aec
and i started receiving the error for mismatch hash when clicking on any of the tree nodes.I matched the view file
_form
and noticed that the code related to$dataToHash
was removed from within the view and only hidden inputs are contained.I removed the sections which are not needed any more and after fixing everything i still get the mismatch hash error, the difference is because of the class name
btn-default
within the start of the string after the model name,common\models\Campaignbtn-default
that is in the old hash but not in the new , that is the only difference which is not allowing it to match see below.I have been scratching my head about where it is being added from in the old hash, and how can I remove it.
Also, how can I freeze the extension on a specific version and not update if I run
composer update
, I have"kartik-v/yii2-tree-manager": "@dev",
in mycomposer.json
file.