function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RatherGeekyRatherGeeky 

Web-to-Lead with Internet Explorer - Doesn't Pass Custom Fields with IDs Starting with Number

The ID for custom fields in salesforce begins with a number. When using Internet Explorer, when we use web-to-lead & try to pass information from a form into salesforce, the custom field information does not get passed. Other information (oid, first name, last name) gets passed fine. And when using Firefox, Chrome or Safari, all information passes through correctly (although in these browsers, we are using ajax/javascript to submit the forms, as opposed to using the standard form action method=POST in IE).


In our HTML <form>, we use <input> elements (type=hidden), where the name & id attributes are equal to the salesforce custom field ID. However, starting an id or name attribute with a number is improper HTML (according to the w3c).
We have also tried using the custom field name in salesforce, but that did not work in IE either.

What's weird is that some of the fields are passing through (oid, first name, etc.), and the lead is being created, but we are still missing a few of our custom fields.

Is there a way to change the custom field IDs in salesforce to begin with a letter instead of a number? We'd like to try that.

Or if you have other/better suggestions, we'd really appreciate it.

 

jhurstjhurst

You cannot change the ID of a custom field inside of salesforce.com.

 

I tested a variety of fields using IE7 and IE8 and the fields came in without issue.  Can you describe a bit more about which fields are not coming in?  The first thing that comes to mind would be lookup fields.  If these are the ones having issues, remember that you have to pass in a valid record ID to populate a lookup field.

 

Another way would be to use the salesforce.com API to create the record.

 

Hope this helps

Jay

RatherGeekyRatherGeeky

Jay:

 

Thank you very much for your response. 

 

We are passing these fields:

  • Source Form (Text, 100 chars)
  • Source Form Details (Text, 155 chars)
  • Website Source URL (URL)

 

This consistently happens with IE, but not Chrome or Firefox.

 

We are not passing values that are longer than the text field length.

jhurstjhurst

Jenna,


Those field types are working for me.  This makes me think it is likely an issue with the data you are passing and encoding of the form data.


Can you log a support case with the sample of the web form that is failing, an example of data that you are passing, and any other information you can think of?  Then add a comment with the case number and I will take a look.

 

Thanks.

Jay

Dave W.ax924Dave W.ax924

Jay,

 

I'm the developer working with Jenna on her Salesforce integration. While she can hopefully submit a support ticket, I'll go ahead & post the code we are using. We have several forms that are all slightly different, but you can get the main idea from the code below: (I stripped out a bunch of html tags used for formatting)

 

<form id="newsletter-subscribe-form" action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="post">
<input type="hidden" id="oid" name="oid" value="00D70000000KLcJ" />
<input type="hidden" id="lead_source" name="lead_source" value="Website.FormSubmit" />
<!-- source_form --><input type="hidden" id="00N70000002PRxu" name="00N70000002PRxu" value="Subscribe-Form" />
<input type="hidden" id="source_form_details" name="source_form_details" value="Newsletter" />
<input type="hidden" id="page_url" name="page_url" value="http://www.aerometric.com/services/aerial-photography/" />
<label for="first_name">First Name</label>
<input id="first_name" maxlength="40" name="first_name" type="text" />
<label for="last_name">Last Name</label>
<input id="last_name" maxlength="80" name="last_name" type="text" />
<label for="email">Email</label>
<input id="email" maxlength="80" name="email" type="text" />
<label for="company">Company</label>
<input id="company" maxlength="40" name="company" type="text" />
<input id="btn-subscribe" type="submit" name="submit" value="Subscribe" />
</form>

What I find weird... is that the oid is obviously being passed through because it knows to create the lead in Jenna's account. All the firstname, lastname stuff is passing OK as well. It's the other hidden fields that are not.
You'll see I even tried using the ID of the custom field for source_form, instead of just using the custom name, like I did with lead_source.
If you see anything strange here, please let me know. This is my first time using Salesforce's web-to-lead integration, so it could be a rookie mistake.

I really appreciate your help,
Dave

 

jhurstjhurst

Dave,

 

In order to say 100% I would need login access so that I could test.

 

Lookinfg at the below,you have:

 

 

<input type="hidden" id="source_form_details" name="source_form_details" value="Newsletter" />
<input type="hidden" id="page_url" name="page_url" value="http://www.aerometric.com/services/aerial-photography/" />

 In order for the system to link to the correct salesforce.com field, you would have to actually use the Field ID.  You can get this by looking at the URL when you view the field in salesforce.com.  From what I can see, it should be:

 

 

<input type="hidden" id="00N70000002PRxz" name="00N70000002PRxz" value="Newsletter" />
<input type="hidden" id="00N70000002PRy4" name="00N70000002PRy4" value="http://www.aerometric.com/services/aerial-photography/" />

 I took a guss here, as it does not look like you have a "Page_URL" field on Leads, so I chose "Website_Source_URL".

 

I tried the code in my test org (changing the field names to fields in my org) and the data came in as expected with IE7 and IE8.

 

Jay

 

 

Dave W.ax924Dave W.ax924

Jay,

 

You were right on the money. Thanks for your help.

 

Because we have multiple lead forms on each page, and because we were using Ajax to submit them (with Chrome/FF/Safari... IE won't allow cross-domain Ajax calls)... our ID and NAME attributes were all out of whack.

 

SF only takes the values from the name= attribute. So for IE (which is using the standard form action POST method), we used the custom field IDs for the name=. And according to the w3c, you are allowed to have multiple name= attributes per page, as long as you don't have the same name= attribute more than once per <form>.

 

And then for the other browsers (not IE), we used unique IDs for each field (not related to salesforce at all), and pulled their values by using javascript, and then submitted the form with Ajax.

 

Bottom line... forms submit in all browsers, and all information was successfully passed through.

 

Thanks again,

Dave

Dave W.ax924Dave W.ax924

Oh, and the original thing with IDs starting with a number...

 

They still are not allowed to start with a number (according to W3C specs), but that's OK, because the custom field IDs only need to be tied to the name= attribute, no the id= attribute.

 

And the name= attribute allows you to start it's value with a number.

CaptainObviousCaptainObvious

You could probably use javascript to create the necessary fields on Submit (allowing your HTML to pass W3C validation)

 

Here's an example using jQuery:

 

$('#newsletter-subscribe-form').bind('submit', function() {

    //Get the page URL from the HTML hidden input 
    var pageURL = $('#page_url').val();

    //Create the hidden field
    $('<input type="hidden" name="00N70000000XXxx" id="00N30000000XXxx" value="'+ pageURL +'" />').appendTo('#newsletter-subscribe-form');

    //Handle validation errors or submit the form...

});