I was unable to display the payment form for "My Custom Gateway" when the method is selected.

enter image description here

I have created the form.phtml template and it is loaded correctly. I can see the tag is loaded properly. Moreover it is visible even when I have not choose that method yet. Thus I have to hide the form until the the gateway is selected, so I have the following form.phtml:

// PHP Code
<ul class="form-list" id="mygateway_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
        <div class="input-box">
            This will be the Forms

In my Model, I'm extending Mage_Payment_Model_Method_Abstract instead of CC

I couldn't find any reference in the Magento source code that take care this trivial logic: hiding and showing payment form.

So, in magento, how to make my payment form visible when the user click on that particular payment methods?

Reference List


1 Answer 1


Looking at the payment/methods.phtml, the input.onclick will trigger a payment.switchMethod($_code).

Going deeper to the varien/payment.js:switchMethod function, the naming convention is important for the form. the id has to begin with payment_form_<paymentmethod>

Thus, I've made a mistake in the forms.phtml. It should be:

<ul class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">

Now it is correctly display the form.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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