I am using the Validate plugin for validating our contact form which
sends data into SalesForce. We just implemented the AdWords plugin for
SalesForce and they say that using form.submit will break their
javascript for SalesForce. Currently with the Validate plugin I do
some custom functions using the SubmitHandler option for creating
values in the fields that go into SalesForce and at the end I use
form.submit.

$("#EmailForm").validate({
                errorContainer: container,
                errorLabelContainer: $("ul", container),
                wrapper: 'li',
                meta: "validate",
                submitHandler: function(form) {
                        var comp = $("input[name='company']").val();
                        var ph = $("input[name='phone']").val();
                        var em = $("input[name='email']").val();
                        var ln = $("input[name='last_name']").val();
                        var fn = $("input[name='first_name']").val();
                        var comments = $("[name='comments']").val();
                        var prod = "";
                        //var checkboxes_product_code;
                        //checkboxes_product_code = 
$('.product:checkbox').attr("name");
                        //alert(checkboxes_product_code);
                        var checkbox_count = 0;
                        $(':checkbox:checked').each(function(checkbox_count){
                                if(checkbox_count < 
$(':checkbox:checked').length - 1){
                                prod += $(this).val() + ", ";
                                }
                                else{
                                prod += $(this).val();
                                }
                                return checkbox_count++;
                        });

                        var det =  fn + " " + ln + " of " + comp +" completed 
the form on
the website and would like information on " + prod +".  Please contact
" + fn + " at your earliest convenience at " + ph +" or " + em +".";

                        if(comments != ""){
                                det = det + " Comments / Questions: " + 
comments;
                        }
                        //$("input[name='" + checkboxes_product_code + 
"']").val(prod);
                        $("input[name='xxxx0000000jroe']").val(det);
                        //console.log($("input[name='xxxx0000000jroe']").val());
                        //alert($("#xxxx0000000jroe").val());
                        form.submit();
                }

        });

The recommend using an onsubmit call in the form. Plus the javascript
which it uses to determine the lead source is looking for a button to
submit the form. This is there "recommended" way
http://blogs.salesforce.com/adwords/2007/09/web-to-lead-for.html. Any
one have experience with this, or have any suggestions of not using
form.submit? Thanks.

Seth

Reply via email to