0
我正在开发一个验证框架,并且需要一个布尔结果来知道验证是否成功。'成功'功能如何工作,我该如何模仿它?
下面是我在做什么咋一看:
Stone.Validation({
id: "#InputTextId",//the id of the input you want to validate
DataType: "string",//the Data Type of want to valide(string and integer for now are avaiable)
MsgOk: "Correct",//optional: the msg you want to display if it is a string
MsgWrog: "* Check this field",////optional: the msg you want to display if its not a string
Destiny: "#someDivID",//the id that will some the correct of error message
})
我不知道如何禁用表单提交,如果验证失败。它只是返回消息,但不是布尔值或类似的东西。什么即时寻找
例子:
Stone.Validation({
id: "#InputTextId",
DataType: "string",
MsgOk: "Correct",
MsgWrog: "* Check this field",
Destiny: "#someDivID",
success: function(results)
{
if(results)
{
//submit will work
}
}
})
为什么你使用没有jQuery的HTML ID? – 2013-03-01 21:18:08
如果我使用它有什么问题? – Misters 2013-03-01 21:19:24
是的。当您引用HTML ID时,您需要添加$(“#id-name”)以使jQuery识别它。 – 2013-03-01 21:20:51