Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Form Key Error with Pager on List Views #56

Open
inavdb opened this issue Jul 1, 2021 · 12 comments
Open

Form Key Error with Pager on List Views #56

inavdb opened this issue Jul 1, 2021 · 12 comments
Labels
bug Something isn't working

Comments

@inavdb
Copy link

inavdb commented Jul 1, 2021

Error occures in the integer_net Slider module (see also internal ticket 17261)

When in a list the number of elements exceeds the standard qty er page (here 20), you cannot edit an element when

  1. You navigate to page 2 and try to open an element.
  2. Switching the rows per page to e.g. 50, trying to edit en element any element

Instead, there's a form key error and you end up on the Dashboard.
Editing one of the first 20 elements, when the elements per page = 20 works though.

@Vinai Vinai added the bug Something isn't working label Jul 1, 2021
@Vinai
Copy link
Collaborator

Vinai commented Jul 1, 2021

disproved: Note to self: it seems the form key changes when an Ajax grid update id done.

@Vinai
Copy link
Collaborator

Vinai commented Jul 1, 2021

I can see the action URL is configured as <action id="edit" label="Edit" url="*/*/edit" in the grid XML.
This configuration doesn't work for Ajax updates of the grid, since they happen through a generic Ajax pager route.
Applying the following patch to the grid config should fix the issue:

diff --git a/view/adminhtml/hyva-grid/grid.xml b/view/adminhtml/hyva-grid/grid.xml
index 3b5f08e..b9d8a9f 100644
--- a/view/adminhtml/hyva-grid/grid.xml
+++ b/view/adminhtml/hyva-grid/grid.xml
@@ -17,7 +17,7 @@
         </exclude>
     </columns>
     <actions idColumn="slider_id">
-        <action id="edit" label="Edit" url="*/*/edit" idParam="slider"/>
+        <action id="edit" label="Edit" url="integernet_hyvaslider/slider/edit" idParam="slider"/>
     </actions>
     <navigation>
         <buttons>

I'll leave the issue open for now until you can confirm this fixes the problem.

@Vinai Vinai closed this as completed in f8ee249 Jul 1, 2021
@Vinai
Copy link
Collaborator

Vinai commented Jul 1, 2021

I've patched the UrlBuilder during Ajax requests so it will use the original route to build new URLs.
Now it will work even without a config change.
This will be part of the 1.1.16 release.

@lbuchholz
Copy link

@Vinai I can confirm this working for next page navigation, but clicking previous page link won't update anything.

@Vinai Vinai reopened this Jul 14, 2021
@Vinai
Copy link
Collaborator

Vinai commented Jul 14, 2021

Thanks for letting me know. I'll look into this, but it will be a while because vacation.

@Vinai
Copy link
Collaborator

Vinai commented Jul 14, 2021

@lbuchholz I can't reproduce the issue paging through sliders or the test grids.
Is there any additional info you can give?

@lbuchholz
Copy link

Not really... Use case is hyva_slider with 40+ sliders, page size 20. While I can navigate to next and last page, I cannot go to previous or first page.

@Vinai
Copy link
Collaborator

Vinai commented Jul 14, 2021

Same behavior when you change to a page size of 10?

@lbuchholz
Copy link

Yes.

@Vinai
Copy link
Collaborator

Vinai commented Jul 14, 2021

I have created 30 sliders, no problem with paging back or forth.
Any errors in the console or the ajax response?

@Vinai
Copy link
Collaborator

Vinai commented Jul 26, 2021

Do you have an answer to my question @lbuchholz? Could you check in the network tab in the devtools if there is some kind of exception or something?

@lbuchholz
Copy link

@Vinai Sorry for taking such a long time to respond. I just did a complete reinstall of all modules involved et voilà, works. 🙄
Please close, thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants