自动提交后重置选择值

时间:2019-10-10 07:33:49

标签: select form-submit reset onsubmit complete

我有此联系表格,正在努力将值重置为默认值。当我使用表单并选择值时,我会自动重定向到产品页面,但是所选值不会重置为默认值(在我的情况下为空字段)!

这是我的完整代码:

    <form method="post" action="<?php echo $this->getActionUrl() ?>"
      location="<?php echo $this->getLocation() . ' ' . $this->getCmsId() ?>"
      class="<?php echo $this->isHide() ? 'amfinder-hide' : '' ?>">
    <input type="hidden" name="finder_id" value="<?php echo $this->getId() ?>"/>
    <input type="hidden" name="back_url" value="<?php echo $this->getBackUrl() ?>"/>
   <input type="hidden" name="reset_url" value="<?php echo $this->getResetUrl() ?>"/>
    <input type="hidden" name="category_id" value="<?php echo $this->getCurrentCategoryId() ?>"/>
    <div class="amfinder-horizontal" id="<?php echo $finderId ?>Container">
        <div class="amfinder-title">
            <span><?php echo $finder->getName() ?></span>
        </div>
        <ul class="amfinder-toggle">
            <?php foreach ($finder->getDropdowns() as $dropdown): ?>
                <li>
                    <div class="dropdown-title"><?php echo $this->__($this->htmlEscape($dropdown->getName())) ?></div>
                    <div class="dropdown-element amshopby-clearer">
                        <select <?php echo $this->getDropdownAttributes($dropdown) ?>">
                        <?php foreach ($this->getDropdownValues($dropdown) as $v): ?>
                            <option value="<?php echo $v['value'] ?>"
                                <?php if ($v['selected']): ?>
                                    selected="selected"
                                <?php endif ?>>
                                <?php echo $this->htmlEscape($v['label']) ?>
                            </option>
                        <?php endforeach ?>
                        </select>
                    </div>
                </li>
            <?php endforeach ?>
            <li class="last">
                <div class="amfinder-buttons"
                     style="display:<?php echo($this->isButtonsVisible() ? 'block' : 'none') ?>">
                    <button class="button" title="<?php echo $this->__('Find') ?>" type="submit">
                        <span>
                            <span>
                                <?php echo $this->__('Find') ?>
                            </span>
                        </span>
                    </button>
                    <button class="button" name="reset" value="1" title="Reset"
                            type="submit">
                        <span>
                            <span>
                                <?php echo $this->__('Reset') ?>
                            </span>
                        </span>
                    </button>
                </div>
            </li>
        </ul>
    </div>
</form>
<script type="text/javascript">
    var <?php echo $finderId ?>  = new amFinder(
        '<?php echo $finderId ?>Container',
        '<?php echo $this->getAjaxUrl() ?>',
        '<?php echo $this->__('Loading...')?>',
        '<?php echo Mage::getStoreConfig('amfinder/general/partial_search')?>',
        <?php echo intval(Mage::getStoreConfig('amfinder/general/auto_submit')) ?>
    );
</script>

谢谢。

0 个答案:

没有答案