custom block view form submitting twice.

Permalink
Can anyone tell me why my form in my block view is submitting twice?
In block view:
<form id="shiftregister<?php echo $bID;?>" method="post" action="<?php  echo $view->action('register_for_shift'); ?>">
<input type="submit" class="remodal-confirm remodal-btn" value="Yes" />
        </form>


in block controller
public function action_register_for_shift(){
 var_dump('action!');
        $this->view();
}


The issue is when I click on the view form submit button, when my page refreshes.... the top of the page the var dump code I have in the action function in the controller outputs twice... Does anyone know why the form submit fires the block controller action function twice? Very frustrating....

 
Gondwana replied on at Permalink Reply
Gondwana
I struggled with this. I found that the submit action could be called twice in several circumstances. I think I nutted it out eventually, but it was pretty ugly. You can see my solution in
https://www.concrete5.org/marketplace/addons/contact-form-no-links1...
(It's free, so this isn't really a plug!)
glin425 replied on at Permalink Reply
Hey Gondwana,
Thank you for the help, but.... This doesnt solve my issue.

public function action_register_for_shift($bID = false){
        if ($this->bID != $bID) {
            return false;
        }
        var_dump('action!');
    $this->view();
    }

I still receive the output at the top of the page below:
string(7) "action!"
string(7) "action!"

So my function is being ran twice when I submit a form in my block view file.

I only have one instance of this block type on the page... so im not sure why this gets ran twice.