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
zekay2000zekay2000 

Javascript Error with Web-to-lead and custom fields

Hello,

Salesforce.com custom fields have preassigned field names that start with zeroes "00N000000etc". (Doesn't conform to W3C standards: http://www.w3.org/TR/html401/types.html#type-name)

For some reason, client-side JavaScript raises an error whenever I try to access a custom field. Using eval(  ) doesn't work either. If the first character of the field name starts with a character, it all works fine. Any workarounds?

  // these don't work
 eval("alert(myForm.00N00000006ozIN.value)");
alert(myForm.00N00000006ozIN.value);

  // these work
 eval("alert(myForm.x00N00000006ozIN.value)");
alert(myForm.x00N00000006ozIN.value);

Thanks so much.

-Zach.

Message Edited by zekay2000 on 07-30-2004 04:27 PM

DevAngelDevAngel

Hi zach,

You are correct in your assertion that the field names that start with a numeric don't conform.  That is why we modified the names back in 2.0 to have a cf_ prepended to them.  2.0 was the last version of xml-rpc and is the process of being de-supported.  In SOAP sforce 2.5 and above, custom fields have friendly, user assigned names.

Please consider moving to the SOAP interface if you are using xml-rpc, or the 2.5 API if you are using SOAP and the 2.0 API.

zekay2000zekay2000

Hey Dave,

Thanks for your reply. I'm going to expose myself as a total newbie and ask a most likely silly question: In salesforce.com, when I define a custom field for a lead and then generate the html for the web-to-lead form the field names are assigned automatically, without the "cf_" prepend. Is there a setting I need to change to take care of this?

Thanks so much!

-Zach.

DevAngelDevAngel

Hi zach,

This looks like a bug, smells like a bug, walks like a bug.......

I think you've uncovered a bug!

I will file it as such with our dev team.  Hopefully we'll get a fix out before long (a week or so).

 

zekay2000zekay2000

Hey Dave,

Any ETA on when this will be fixed. Client wants to know.

Thanks!

-Zach.

onthebeachonthebeach
Although javascript identifiers aren't _supposed_ to start with digits, a solution to the original poster's problem is to use the 'elements' array:

alert(myForm.elements['00N00000006ozIN'].value);


onthebeach
dave k.ax63dave k.ax63
Having just come up against this issue, it appears the bug did not get fixed as part of Summer '05.

Cheers

Dave.