[SOLVED] Admin form action issue with Cancel toolbar button - Joomla! Forum - community, help and support
hi all, , best wishes 2013!
i'm developping custom component, , have issue on admin side.
i have first default page list of uploads (id, file_name, etc).
when click 1 entry, go second view, "validatefile".
on second page, want add cancel button on toolbar, able te return list.
so here's i've done far.
in "validatefile" view (view.html.php), have added toolbar jtoolbarhelper, , added toolbar button this:
in default template (default.php), have :
ok page shows "hello world" , cancel button, dummy code here perform form submission.
when click on cancel toolbar button, form action 'option=com_dropfileszone&view=adminlistv1ew' executed, can see blank page blank toolbar (see attached file).
although url enough : administrator/index.php?option=com_dropfileszone&view=adminlistv1ew.
because when refresh page, list !
the workaround have found override cancel method in 'validatefile' controller :
so php setredirect function working, not form action.
can point me if i'm doing wrong, of if there's better way ?
i'm sure missed something, , missunderstood joomla mechanism
any appreciated
i'm developping custom component, , have issue on admin side.
i have first default page list of uploads (id, file_name, etc).
when click 1 entry, go second view, "validatefile".
on second page, want add cancel button on toolbar, able te return list.
so here's i've done far.
in "validatefile" view (view.html.php), have added toolbar jtoolbarhelper, , added toolbar button this:
code: select all
jtoolbarhelper::cancel('validatefile.cancel', 'jtoolbar_cancel');in default template (default.php), have :
code: select all
<script type="text/javascript">
joomla.submitbutton = function(task)
{
if (task == 'validatefile.cancel') {
joomla.submitform(task, document.getelementbyid('validatefile-form'));
}
}
</script>
<form action="<?php echo jroute::_('index.php?option=com_dropfileszone&view=adminlistv1ew'); ?>" method="post" name="adminform" id="validatefile-form" class="form-validate">
hello world
<input type="hidden" name="task" value="" />
<?php echo jhtml::_('form.token'); ?>
<div class="clr"></div>
</form>ok page shows "hello world" , cancel button, dummy code here perform form submission.
when click on cancel toolbar button, form action 'option=com_dropfileszone&view=adminlistv1ew' executed, can see blank page blank toolbar (see attached file).
although url enough : administrator/index.php?option=com_dropfileszone&view=adminlistv1ew.
because when refresh page, list !
the workaround have found override cancel method in 'validatefile' controller :
code: select all
function cancel() {
$this->setredirect(jroute::_('index.php?option=com_dropfileszone&view=adminlistv1ew', false));
}so php setredirect function working, not form action.
can point me if i'm doing wrong, of if there's better way ?
i'm sure missed something, , missunderstood joomla mechanism
any appreciated
please use jtoolbarhelper::back() instead. check http://docs.joomla.org/jtoolbarhelper/back
Comments
Post a Comment