在 Joomla! 提交表单后留在同一页面!后端
Stay at the same page after the form is submitted at the Joomla! back end
我在 com_product 的管理端 default.php 中得到了一个表格。问题是,表单在提交后重定向回控制面板。我需要它留在当前页面。
表单使用 GET 方法作为操作,我已经尝试了所有这些:
<form method="get" action="<?php echo $current_url; ?>">
...
$current_url = $_SERVER['QUERY_STRING'] . '&' . $_GET['date_scope']; // Results: administrator/index.php?date_scope=1&submit_range=
还有:
$current_url = $_SERVER['QUERY_STRING']; // Results: administrator/option=com_product&view=reports?date_scope=1&submit_range=
还有:
$current_url = JURI::root() . 'administrator/index.php?option=com_product?' . $_SERVER['QUERY_STRING'] . $_GET['date_scope']; // Results: administrator/index.php?date_scope=1&submit_range=
还有:
$current_url = $_SERVER['REQUEST_URI']; // Results: administrator/index.php?date_scope=1&submit_range=
还有:
$current_url = JURI::root() . 'administrator/index.php?option=com_product'; // Reuslts: administrator/index.php?date_scope=1&submit_range=
还有:
$current_url = JURI::root() . 'administrator/index.php?option=com_product' . $_GET['date_scope']; // Results: administrator/index.php?date_scope=1&submit_range=
知道如何处理,以便在提交表单后保持在同一页面吗?
如果您在没有特殊重定向的情况下让提交通过控制器,它应该留在那里。它应该默认为当前视图。
在模板中使用 JHTML::_('behavior.keepalive')
。
我在 com_product 的管理端 default.php 中得到了一个表格。问题是,表单在提交后重定向回控制面板。我需要它留在当前页面。 表单使用 GET 方法作为操作,我已经尝试了所有这些:
<form method="get" action="<?php echo $current_url; ?>">
...
$current_url = $_SERVER['QUERY_STRING'] . '&' . $_GET['date_scope']; // Results: administrator/index.php?date_scope=1&submit_range=
还有:
$current_url = $_SERVER['QUERY_STRING']; // Results: administrator/option=com_product&view=reports?date_scope=1&submit_range=
还有:
$current_url = JURI::root() . 'administrator/index.php?option=com_product?' . $_SERVER['QUERY_STRING'] . $_GET['date_scope']; // Results: administrator/index.php?date_scope=1&submit_range=
还有:
$current_url = $_SERVER['REQUEST_URI']; // Results: administrator/index.php?date_scope=1&submit_range=
还有:
$current_url = JURI::root() . 'administrator/index.php?option=com_product'; // Reuslts: administrator/index.php?date_scope=1&submit_range=
还有:
$current_url = JURI::root() . 'administrator/index.php?option=com_product' . $_GET['date_scope']; // Results: administrator/index.php?date_scope=1&submit_range=
知道如何处理,以便在提交表单后保持在同一页面吗?
如果您在没有特殊重定向的情况下让提交通过控制器,它应该留在那里。它应该默认为当前视图。
在模板中使用 JHTML::_('behavior.keepalive')
。