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
smagee13smagee13 

Web to Lead javascript invalid fieldID values

New to javascript development so please be patient.

 

I have a web to lead form that is working just fine and I am not adding some javascript to disable/enable text boxes on a check box selection.  All is working just fine but now I need to post the from to SalesForce Lead and am using custom fields with invalid javascript ID names like "000Ndvdfdf"

 

I've read some workarounds on the boards but can't see to get this working just right.  Below is my code snippet and with this Im receving the dreaded  

 

'document.Form1.adminname' is null or not an object 

 

I have the javascript just above the </body> tag.

 

Any other advise?

<tr> <td width="3%">&nbsp;</td> <td width="18%"><font face="Arial">Same as Above</font></td> <td width="78%"><input type="checkbox" name="Check1" onClick="MTMAdminChange()"/></td> </tr> <tr> <td width="3%">&nbsp;</td> <td width="18%"><font face="Arial">MTM Admin name</font></td> <td width="78%"><font face="Arial"> <input id="00N60000001eqbc" maxlength="100" name="00N60000001eqbc" size="64" type="text" value="Same as above" /></font></td> </tr> <tr> <td width="3%">&nbsp;</td> <td width="18%"><font face="Arial">MTM Admin phone</font></td> <td width="78%"><font face="Arial"> <input id="00N60000001eqbg" maxlength="40" name="00N60000001eqbg" onkeydown="formatPhoneOnEnter(this, event);" size="34" type="text" value="Same as above" /></font></td> </tr> <tr> <td width="3%">&nbsp;</td> <td width="18%"><font face="Arial">MTM Admin email</font></td> <td width="78%"><font face="Arial"> <input id="00N60000001eqbh" maxlength="80" name="00N60000001eqbh" size="64" type="text" value="Same as above"/></font></td> </tr><script language="javascript"> function MTMAdminChange() { var adminname = document.getElementById('00N60000001eqbc'); var adminphone = document.getElementById('00N60000001eqbc'); var adminemail = document.getElementById('00N60000001eqbc'); if (document.Form1.Check1.checked === true) {document.Form1.adminname.disabled = true; document.Form1.adminphone.disabled = true; document.Form1.adminemail.disabled = true;} else { document.Form1.adminname.disabled = false; document.Form1.adminphone.disabled = false; document.Form1.adminemail.disabled = false; } }</script>