问题描述
我已经为Salesforce.com提供了一个表单,我需要对其进行客户端验证。我正在使用Jquery验证插件。表单中包含一个如下的下拉列表:
< ; select id =00N2000002pPvPname =00N2000002pPvPtitle =Region>
Salesforce已通知他们无法更改它。
我的问题是使用的令牌以数字开头,所以当我尝试将它添加到我的代码中时,我得到一个语法错误,因为Javascript变量不能以数字开始。
jQuery(document).ready(function($){
var validator = $(#enquiryform)。validate({ b $ b规则:{
last_name:必填,
公司:必填,
电子邮件:必填电子邮件,
国家/地区:必填
00N20000002pPvP:{
selectNone:true
}
},
消息:{
姓氏:必填,
公司:必需,
email:必填,
国家:必填,
00N20000002pPvP:必填
}
});
});
除了更改使用的令牌之外,有没有办法解决这个问题?
试试这个:
'00N20000002pPvP':{
selectNone:true
}
您也可以向供应商解释这种形式的 id
不能以数字开头,以便他们解决它。
I have been supplied a form by Salesforce.com for which I need to do client side validation. I am using the Jquery validation plug-in.
The form contains a dropdown list which like this:
<select id="00N2000002pPvP" name="00N2000002pPvP" title="Region">
I have been informed by Salesforce that they cannot change it.
My problem is that the token used starts with a numeric, so when I try to add it to my code I get a syntax error because a Javascript variable can't start with a digit.
jQuery(document).ready(function($) {
var validator = $("#enquiryform").validate({
rules: {
last_name: "required",
company: "required",
email: "required email",
country: "required"
00N20000002pPvP: {
selectNone: true
}
},
messages: {
last_name: "Required",
company: "Required",
email: "Required",
country: "Required",
00N20000002pPvP: "Required"
}
});
});
Apart from changing the token used, is there any way around this?
Try this:
'00N20000002pPvP': {
selectNone: true
}
Also you may kindly explain to the supplier of this form that an id
cannot start with a number so that they fix it.
这篇关于Jquery表单验证问题:Salesforce字段ID以数字开头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!