我想使用此验证表单
http://mootools.floor.ch/en/download/
但不起作用。
<form name="niceform" id="third" action="" class="niceform" method="post" enctype="multipart/form-data">
<div class="titlu_form"> categoría: </div>
<div class="option_form">
<select name="categorie" id="categorie" class="validate['required']">
<option value=""> -- Elige categoría -- </option>
<option value="1"> 1 </option>
<option value="2"> 2 </option>
<option value="3"> 3 </option>
</select>
</div>
<div class="titlu_form"> provincia: </div>
<div class="option_form">
<select name="provincia" class="validate['required']">
<option value=""> -- Provincia -- </option>
<option value="Castellon"> Castellon </option>
<option value="Valencia"> Valencia </option>
</select>
</div>`
<div class="titlu_form"> marca: </div>
<div class="option_form">
<select name="marca12" id="marca" class="validate['required']">
<option value=""> -- Marca -- </option>
<option value="jeans"> jeans </option>
<option value="other"> other </option>
</select>
</div>
<input type="submit" name="Submit" />
</form>
这是我用于验证的脚本
<script type="text/javascript" src="lightform/mootools.js"></script>
<script type="text/javascript" src="lightform/formcheck.js"></script>
<script type="text/javascript">
//h
window.addEvent('domready', function(){
formcheck = new FormCheck('third', {
display : {
fadeDuration : 500,
errorsLocation : 1,
indicateErrors : 1,
showErrors : 1
}
})
//$('marca').removeAttribute('class');
formcheck.dispose($('marca'));
});
//and this is opcionaly for a select option
$('categorie').addEvent('change', function(event){
var selection = document.getElementById('categorie').value;
alert(selection);
if(selection==1) {
alert(selection);
formcheck.dispose($('marca'));
$('marca').removeAttribute('class');
}
});
</script>
导致此错误:
formcheck.dispose is not defined.
我想在选择选项2或3时隐藏div marca ..那是.. 怎么样..
答案 0 :(得分:0)
好的,所以你说你在moo 1.11和1.45
中尝试过这是你的问题。它是为1.2.x写的
我将此移植到1.4.x前一段时间使用下面的代码库,你的问题就会消失
http://www.timwickstrom.com/client-side-code/mootools/moofloor-formcheck-for-mootools-1-4-x/