William Buttlicker
William Buttlicker

Reputation: 6000

Pass value in joomla.submitbutton

I have made a submit button using joomla's button like this:

<button onclick="Joomla.submitbutton('autoresponder.transfer')">Edit</button>

I want to pass an 'id' along to autoresponder's transfer function from here. How can i do that? I tried it using a hidden field like this:

<input type="hidden" name="id" value="<?php echo (int) $item['id']; ?>">      
      <button onclick="Joomla.submitbutton('autoresponder.transfer')">Edit</button>

But it is not giving me value. Please help!!

Upvotes: 0

Views: 4158

Answers (1)

Atanu
Atanu

Reputation: 67

1) instead of <button> you use "submit" like <input type="submit"> .It will work and capture that hidden field with $_POST / $_GET .This usually works for joomla.

Before you submit the form in each handler:

document.getElementById("hiddenId").value = "mySpecialValue";

Like :

<input id="buttonA" type="button" value="do something" onclick="buttonA_clickHandler(event);"/>

function buttonA_clickHandler(event) {
    document.getElementById('hiddenId').value = whatever;
    document.getElementById('theForm').submit();
}

2) To pass the value without form submit you can use link . like :

<a href="x.php?id='hiddenfieldname'">Do something </a> 

I think this will solve your issue.

Upvotes: 1

Related Questions