开发者

Jquery form validation problem: Salesforce field id starts with digit

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 wh开发者_如何学Goen 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.


how about putting single quotes around them ? '00N20000002pPvP': "Required"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜