0

I need to get html radio button data and call upgradeschema.php file, because to my data to database.

This is my html(template) file.

<html>
    <form **action**="..........">
<input type="radio" name="type" value="html" checked> Html<br>
<input type="radio" name="type" value="text"> Text<br>
<input type="submit" name="button" value="submit"><br>
</form>
</html>

This is my form, When click submit button get data from form and call to upgradeschema class file then store the form data to database.

My question is which action class i put into form action part, CaI i call directly upgradeschema call in magento2. or how to get data from form and store database in magento 2 way.

  • What about the form action? It should have some URL for data submission, right? From this point, if you have URL, than you have a controller. If you have a controller and if you really need to use observer - you can register it on the controller's "predispatch" event. – Yaroslav Rogoza Apr 22 '16 at 12:49
1

There's a big difference between frontend JavaScript events and Magento backend events. You cannot capture a click event by Magento observer until this click does not fire request to the server side. When some call to the server side has been triggered - you can "catch" this request and data passed over this request on the server side by registering observer to the "controller predispatch" event or similar events.

  • Thanks, can you please explain bit more. provide hints to send request to server or any related article ping me. – Rajkumar .E Apr 22 '16 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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