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
MaconeMacone 

Web to lead - validation of Sforce Custome fields which have leading zeros - help

MaconeMacone
After days of struggling with Front page web bots overwriting my coding attempts, the solution is a simple one found on this forum.

Convert the custom force variable to a strvariable like so

strVariable = document.webform['00N20000000kuLd'].value;

Then use that in the validation like so

if (strVariable == "") {alertMessage += "\nNo of financials licenses" }

Hope this helps another newbie.
DevAngelDevAngel

Hi Macone,

Have you tried getDocumentElementById()?

function validate()
{
	with (document.webform)
	{
		var alertMessage = "The following REQUIRED fields\nhave been left empty:\n";
		if (email.value == "") {
			alertMessage += "\nEmail" 
		}
		if (document.getElementById("00N20000000kuLd").value == "") {
			alertMessage += "\nNo of financials licenses" 
		}

		if (alertMessage != "The following REQUIRED fields\nhave been left empty:\n")
		{
			alert(alertMessage);
			return (false);
		}
	}
}
Â