Post · 2009-12-06 16:10

Re: [web] jquery validator usage

作者Tony1223.bbs@aurora.mis.yzu.edu.tw (沉默是金)
標題Re: [web] jquery validator usage
時間北極光 (2009/12/06 Sun 15:57:47)
※ 引述《Tony1223 (沉默是金)》之銘言:
<font class="A03640">> http://blog.sina.com.tw/vipcase/article.php?pbgid=64991&entryid=587063</font><font class="A03740">
implements _enum rule
/**
* check if the value exist in the array
* @param param Array for input check
* @author TonyQ
*/
jQuery.validator.methods._enum = function(value, element, param){
if(!param) return true;
for(var i=0;i<param.length;++i){
if(value==param[i])
return true;
}
return false;
};
example
$("#orderForm").validate({
rules: {
floorType_s:{
required:true,
_enum:["樓梯","電梯"]
},
}
});
--
▄▅▆▇███▇▆▅▄▃ ╰┼╯─╮ ╮
◥███████████◣ ╰┼╯=│=│
◥██████───────◣ *.╯ ╯ ╯ の物語.*
◥███████──────◣~◢◣ ◢◣
◥██████───────◤ ◥◤* 空白的世界.翼 *◥◤
◥██▁▂▃▄▅▆▇███▆▅▄▃▂▂~telnet://tony1223.no-ip.info
--
╭═ Origin ─═ 北極光 aurora.twbbs.org κλμ ─╣
╚─ Author ═─ 220-136-156-164.dynamic.h
Tony1223 修:從 220-136-156-164.dynamic.h 修改文章 12/06 15:57
</font>
Replies
0
Likes
0
Reposts
0

Comments

No approved comments yet.