0

we are using following code to "Delete Products"

<form action="<?php echo $this->getUrl('marketplace/marketplaceaccount/massdeletesellerpro') ?>" method="post" id="formmassdelete" name="formmassdelete">
                            <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
                            <button class="button" title="<?php echo $helper->__('Delete Products') ?>" type="submit" style="float: left;padding: 5px 5px 5px 0;"  id="mass_delete_butn">
                                <span><span><?php echo $helper->__('Delete Products') ?></span></span>
                            </button>

Its working fine. but when we used this code inside table, its not working. even The above code have tag. and even Table also included in tag. is that the reason ?

<form action="<?php echo Mage::helper('core/url')->getCurrentUrl();?>" method="post">
                        <table>
                            <thead>
                                <tr id="wk_mp_tr_heading">
                                    <th><span><?php echo $helper->__('Product Name') ?></span></th>
                                    <th><span><?php echo $helper->__('Date') ?></span></th>

                                </tr>
                            </thead>
                            <tbody class="wk_mp_body">
                                <tr>
                                    <td>
                                        <input type="text" class="input-text" name="s" placeholder='<?php echo $helper->__('Search by product name') ?>' value="<?php echo $this->getRequest()->getParam('s')?>"/>
                                    </td>

                                    <!-- delete -->
                                    <td>

                            <form action="<?php echo $this->getUrl('marketplace/marketplaceaccount/massdeletesellerpro') ?>" method="post" id="formmassdelete" name="formmassdelete">
                            <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
                            <button class="button" title="<?php echo $helper->__('Delete Products') ?>" type="submit" style="float: left;padding: 5px 5px 5px 0;"  id="mass_delete_butn">
                                <span><span><?php echo $helper->__('Delete Products') ?></span></span>
                            </button>
                                    </td>
                                    <!-- delete -->


                                </tr>
                            </tbody>
                        </table>
                    </form>

enter image description here

1

Well, your HTML is not valid here, and I guess that's why it's not working.

You have an HTML form inside another form which is forbidden:

http://www.w3.org/TR/xhtml1/#prohibitions

On top of that your second form tag is not closed, it's probably confusing the browser and it's submitting the parent form when clicking the submit button of your second form.

Try fixing your HTML code by avoiding nested forms, that should do the trick ;)

I reckon you should change your code this way, adapt it to your needs in terms of design:

<form action="<?php echo $this->getUrl('marketplace/marketplaceaccount/massdeletesellerpro') ?>" method="post" id="formmassdelete" name="formmassdelete">
                            <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
                            <button class="button" title="<?php echo $helper->__('Delete Products') ?>" type="submit" style="float: left;padding: 5px 5px 5px 0;"  id="mass_delete_butn">
                                <span><span><?php echo $helper->__('Delete Products') ?></span></span>
                            </button>
</form>
<form action="<?php echo Mage::helper('core/url')->getCurrentUrl();?>" method="post">
                        <table>
                            <thead>
                                <tr id="wk_mp_tr_heading">
                                    <th><span><?php echo $helper->__('Product Name') ?></span></th>
                                    <th><span><?php echo $helper->__('Date') ?></span></th>

                                </tr>
                            </thead>
                            <tbody class="wk_mp_body">
                                <tr>
                                    <td>
                                        <input type="text" class="input-text" name="s" placeholder='<?php echo $helper->__('Search by product name') ?>' value="<?php echo $this->getRequest()->getParam('s')?>"/>
                                    </td>

                                    <!-- delete -->
                                    <td>
                                    </td>
                                    <!-- delete -->


                                </tr>
                            </tbody>
                        </table>
                    </form>
  • thanks for the link, i closed the 2nd form tag , no luck..... than i removed the 2nd <form> tag , didt worked, if possible please update the answer with code. – Baby in Magento Mar 11 '16 at 10:15
  • @BabyinMagento see my edit – Raphael at Digital Pianism Mar 11 '16 at 10:17
  • sorry, its not working for me. – Baby in Magento Mar 11 '16 at 10:27
  • "Delete" button is displaying out side the table as you gave code outside the table. – Baby in Magento Mar 11 '16 at 10:46

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.