I've my custom task = request.state

in my controller, I've code like

public function state($param)
     //Do my task

My question is how do I pass $param to


2 Answers 2


In general you override Joomla.submitbutton in your view's php file, set a hidden fields value to the request parameter you wish to send, then finally submit the form.

So say your admin view's template has a field

<input type="hidden" id="myinfo" value="" >

Then you would add some JavaScript to the view's template:

<script type="text/javascript">
Joomla.submitbutton = function(task) {
    jQuery('#myInfo').val('my custom value');
    Joomla.submitform(task, jQuery('#adminForm'));

Then your request's $_POST array will have

[myInfo] => 'my custom value'

@Rob - Thank you very much for your help. However, your method did not work for me. Here's how I made it work:

In my view layout file (default.php):

I added one hidden state field with blank code:

<input type="hidden" name="state" value="" />

In my JS file I added following code:

$('#cancel-request').click(function () {
if (confirm("Are you sure?"))
                return false;

In my controller, I added following code:

public function state()
     $state = $this->input->post->get('state', '');
     // based on $state I made my code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.