php - 自动提交后重置选择值
问题描述
我有这个联系表,我正在努力将值重置为默认值。当我使用表单并选择值时,我会自动重定向到产品页面,但所选值不会重置为默认值(在我的情况下为空字段)。
这是我的整个代码:
<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>
解决方案
推荐阅读
- android - 如何移动活动表单片段“Kotlin”
- javascript - 431(请求标头字段太大)(ReactJS/Flask)
- javascript - 类中对象数组内的对象属性的排序方法
- python - 在python中创建一个打包的气泡/散点图(基于大小的抖动以避免重叠)
- c# - winform C#自定义tabcontrol关闭按钮
- logstash - 发生 Ruby 异常:logstash 中未定义的方法“to_json”
- javascript - 如何倾斜滚动条?
- node.js - MongoError:位置运算符未从查询中找到所需的匹配项。在 Function.create()
- java - 在 Maven 项目中将 log4j.properties 放在哪里?
- javascript - Javascript regex lookbehind:无效的正则表达式组