i'm trying to execute some code using the October's Data Attribute API for front-end forms. The onSend function executes simple codes like echo 'something', but doesn't more complex code, like trying to use mpdf plugin. I guess it's related to AJAX reloading the page, but don't know how to solve it.
I tried using data-request from the Data Attribute API, calling the function onSend, but the code on onSend does not execute.
My form header is as follows:
<form class="register-form" method="POST" data-request="onSave">
and my function onSave:
public function onSave(){
$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<div style="text-align: center"> Test </div>');
$mpdf->Output();
}
Note that both codes are on a component, and the onSave function executes when i try something just like:
echo 'Test';