+ Start a Discussion
kparisekparise 

Change Custom Field ID

Hello. I am working on setting up a web-to-lead form & working in some basic JavaScript validation into the form so we can make sure we're getting the right data into Salesforce. The issue I'm facing is the ID/variable name of my one custom field begins w/ a numeral & JavaScript only accepts variables that begin w/ letters. Is there any way to change the ID of my custom field so my JavaScript validation can work? Or is there a JavaScript work-around someone can recommend?

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
David81David81

You should be able to change the ID of your form element. Just leave the name attribute as is.

All Answers

David81David81

Can't change the field IDs from SFDC. Could you post a sample of the javascript that is giving you the problem? I had a similar sound issue a while back and may be able to help.

kparisekparise

This is the JavaScript validation code for this particular field:

 

if(thisform.00N40000001lKG4.selectedIndex==0)
 {
     alert("Please select a messaging platform.");
    thisform.00N40000001lKG4.focus();
    return false;
 }

 

This is the HTML code for this section of the form:

 

 <td valign="middle"><label for="Lead Platform"><div align="right">Messaging Platform*</div></label></td>
        <td valign="middle">&nbsp;<span class="required"><select  id="00N40000001lKG4" name="00N40000001lKG4" title="Lead Platform">
        <option value selected>--None--</option><option value="Lotus Notes">Lotus Notes</option>
<option value="Microsoft Exchange">Microsoft Exchange</option>
  <option value="Other">Other</option>
</select>

David81David81

You should be able to change the ID of your form element. Just leave the name attribute as is.

This was selected as the best answer
kparisekparise

I knew it would be something that simple, thank you so much, you've been a big help!