How to call an ACTION from a specific CONTROLLER via a Button?

0

Using the following code:

    $this->Html->link(
          'Meus Dados', array(
                   'controller' => 'Groups', 
                   'action' => 'index'
           )
     );

The HTML link is created normally, but if I want to put a BUTTON in place of the LINK, to make it click that it is redirected to a specific ACTION of a CONTROLLER, it does not work.

I'm doing this:

    echo $this->Form->button(
        'Meus Dados', array(
             'label' => '', 
             'style' => 'width: 100%, color: lightslategray', 
             'class' => 'topnav input-append fa fa-twitter fa-fw', 
             'url' => array(
                      'controller' => 'Groups', 
                      'action' => 'index')
         )
    );

But nothing happens when I click the button, what am I doing wrong?

    
asked by anonymous 19.12.2016 / 18:43

1 answer

1

The page URL must be in FORM and not BUTTON

echo $this->Form->create($row, [
    'url' => [
        'controller' => 'Groups',
        'action' => 'index'
        ]
    ]);


    echo this->Form->button('Enviar');

echo $this->Form->end();
    
19.12.2016 / 20:16