I need to confirm either my is validated or not.My form is

 <form action="<?php echo Mage::getUrl('abc_checkout/cart/placeorder'); ?>" method="post" id="confirm_order_form" class="info-static" onsubmit="return submitOrder();">

Add this script to your phtml file.

<script type="text/javascript">
    //< ![CDATA[
        var customForm = new VarienForm('confirm_order_form');
  • Ok, how I would know, form is validated or not, customForm will be true or false, some thing like this – Abdul Ghaffar Feb 23 '16 at 6:14
  • I am already using it. I have to perform an action if form is validated.How can I do this? – Abdul Ghaffar Feb 23 '16 at 6:19
  • 1
    if (customForm.validator && customForm.validator.validate()) { // if validation successful pass then } else { //magento validation fire } Check more at here magentotutorialbeginners.blogspot.in/2014/03/… – Parth Thakkar Feb 23 '16 at 6:22
  • change theForm to dataForm if (dataForm.validator && dataForm.validator.validate()){ $(".confirm-and-place-order").attr("disabled", true); $(".confirm-and-place-order").removeClass('enable'); } else{ //magento validation fire } – Parth Thakkar Feb 23 '16 at 6:35
  • oops, that's my bad, – Abdul Ghaffar Feb 23 '16 at 6: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.