How to check radio button is checked/selected or not by Javascript only?

You can validate the radio button in a form is selected or not with the help of javascript.

<div class="radio-buttons">
      <div class="male">
        <input class="form-radio" type="radio" name="gender" id="radio1" value="male">
        <label class="form-check-label" for="radio1">Male</label>
      </div>

      <div class="female">
        <input class="form-radio" type="radio" name="gender" id="radio2" value="female">
        <label class="form-check-label" for="radio2">Female</label>
      </div>
</div>

Here you can check it by document.querySelectorAll() with the help of attribute name, Continue reading “How to check radio button is checked/selected or not by Javascript only?”

How to generate auto invoice by payment_action for custom payment methods in magento 2?

You can Generate an auto invoice after the order is placed successfully in Magento with the simple configuration.

You can use <payment_action> configuration in the config.xml file to set auto invoice for your custom payment method.

You can check programmatically Convert Order to Invoice Programmatically in Magento 2.

Using payment_action, You don’t need to generate manual action to create an invoice for the order.

You have to just create a config.xml file under your module etc directory. Continue reading “How to generate auto invoice by payment_action for custom payment methods in magento 2?”

How to pass data from Controller to View Template files in Magento 2?

You can pass data from the Controller action to the Template files in Magento via Block Class.

You can’t directly pass controller data to view the template files but using the Block class you can achieve it successfully.

By use of the Magento interface, Magento\Framework\App\Request\DataPersistorInterface We are able to store data by key with the set(), get() method. Continue reading “How to pass data from Controller to View Template files in Magento 2?”