Getting a 404 error when trying to add a Navigation Menu Item

Hi all,

Another mystery here since I upgraded form 2.4 to 3.1. Everything going along well until I attempted to add an external link to one of our journals’ navigation menu.

Clicking “Add Item” works, as the popup box comes up. After that, I select my parameters, then click Save. Screen goes unresponsive. This happens no matter what type of link I try (About, External Link, etc.)

In the Network tab of my browser, I see the response is a 404. The request that gets sent out and 404s is:

--journal path--  &component=grid.navigation-menus.navigation-menu-items-grid&op=update-navigation-menu-item

Anyone encounter this before? Know how to fix? Thanks.

Hi @duspal,

Are you using OJS 3.1.0? If so, I’d suggest upgrading – it’s likely that your issue has been resolved in the latest release. And it’s a good idea to stay up to date.

Regards,
Alec Smecher
Public Knowledge Project Team

Sorry, I should have been more verbose. I’m currently on 3.1.1.1 (latest version at the moment is 3.1.1.2)

Ok, after a little investigation, I found the following in the form:

Compare to the URL path: --journal path-- &component=grid.navigation-menus.navigation-menu-items-grid&op=update-navigation-menu-item

And Op and Page appear twice in the form, once in $_Post, once in $_Get. If I manually remove the above HTML from the form via a browser editor, the form now work.

So, will investigate further late why these two HTML input tags are here and how the code handles it, but in the meantime I wanted to let everyone know I found the root cause.

Quick Update: in the file lib/pkp/templates/controllers/grid/navigationMenus/form/navigationMenuItemsForm.tpl:

<form class="pkp_form" id="navigationMenuItemsForm" method="post" action="{url 
router=$smarty.const.ROUTE_COMPONENT
component="grid.navigationMenus.NavigationMenuItemsGridHandler" op="updateNavigationMenuItem"}">
        {csrf}
        {include file="controllers/notification/inPlaceNotification.tpl" 
notificationId="navigationMenuItemFormNotification"}
        {fbvFormArea id="navigationMenuItemInfo"}
            <input type="hidden" name="page" value="{$page|escape}" />
            <input type="hidden" name="op" value="{$op|escape}" />

In the above code snippet, $op and $page are undefined, hence why we’re getting blank values in $_POST. Yet, these are being defined in the $_GET. Therein, I’m wondering if the code is correct but I have a php configuration issue where value types in $_GET and $_POST are not being handled correctly. Anyone have any thoughts on this?

1 Like

Hi @duspal,

Tackling the 404 error, what’s the value of the disable_path_info in your config.inc.php?

Thanks,
@Dimitris_Efstathiou

1 Like

disable_path_info = On

We’re testing out the 3.x line and thus don’t have the full URLs turned on.

I was wondering if this configuration could be the cause of these issues, but haven’t had a chance to test it out yet. I’ve found a few issues related to this setting, but have been able to diagnose and fix them up to this point.

Hi @duspal.

Could you turn the flag to off, in order to see if the issue persists?

Thanks,
@Dimitris_Efstathiou

Just did, and the issue fixed itself. Fortunately, we intended to turn that flag off when we go live, so it looks like we’re ready to go here. Thanks for the help!