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
s5s5 

Adding image and displaying error message in web to lead form

Hi Team,

 

I created one web to lead form and in that page i need to display one image and if end consumer enters number instead of text it has to display error message.For this how to alter the html code.The below is the html code it generated when i created web to lead form.

 

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <META> element to your page <HEAD>.      -->
<!--  If necessary, please modify the charset parameter to specify the        -->
<!--  character set of your HTML page.                                        -->
<!--  ----------------------------------------------------------------------  -->

<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: Please add the following <FORM> element to your page.             -->
<!--  ----------------------------------------------------------------------  -->

<form action="http://cs3.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8 method="POST">

<input type=hidden name="oid" value="00DQ0000000HDRG">
<input type=hidden name="retURL" value="http://salesforce.com">

<!--  ----------------------------------------------------------------------  -->
<!--  NOTE: These fields are optional debugging elements.  Please uncomment   -->
<!--  these lines if you wish to test in debug mode.                          -->
<!--  <input type="hidden" name="debug" value=1>                              -->
<!--  <input type="hidden" name="debugEmail"                                  -->
<!--  value="kavi_k@gmail.com">                          -->
<!--  ----------------------------------------------------------------------  -->

<label for="salutation">Salutation</label><select  id="salutation" name="salutation"><option value="">--None--</option><option value="Dr.">Dr.</option>
<option value="Dr. Ms.">Dr. Ms.</option>
<option value="Miss">Miss</option>
<option value="Mr.">Mr.</option>
<option value="Mrs.">Mrs.</option>
<option value="Ms.">Ms.</option>
</select><br>

<label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>

<label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>

<label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>

<label for="phone">Phone</label><input  id="phone" maxlength="40" name="phone" size="20" type="text" /><br>

<label for="mobile">Mobile</label><input  id="mobile" maxlength="40" name="mobile" size="20" type="text" /><br>

<label for="street">Address</label><textarea name="street"></textarea><br>

<label for="company">Company</label><input  id="company" maxlength="40" name="company" size="20" type="text" /><br>

<label for="city">City</label><input  id="city" maxlength="40" name="city" size="20" type="text" /><br>

<label for="state">State/Province</label><input  id="state" maxlength="20" name="state" size="20" type="text" /><br>

<label for="country">Country</label><input  id="country" maxlength="40" name="country" size="20" type="text" /><br>

Start Date (mm/dd/yyyy):<span class="dateInput dateOnlyInput"><input  id="00N40000001R1QI" name="00N40000001R1QI" size="12" type="text" /></span><br>

End Date (mm/dd/yyyy):<span class="dateInput dateOnlyInput"><input  id="00N40000001R1QN" name="00N40000001R1QN" size="12" type="text" /></span><br>


Type Name:<select  id="00NQ0000000mQtC" name="00NQ0000000mQtC" title="Type Name"><option value="">--None--</option><option value="Licensee">Licensee</option>
</select><br>

 

<input type="submit" name="submit">

</form>

 

 

I am new to this html code.Please help me in this.

 

Thanks in advance 

skodisanaskodisana

Hi,

 

Since these are the client side validation rules we need to use Java Script. Include the below code in script tag call it from the input field onKeyUp event

 

function ValidateForm(form)
{
   if(IsEmpty(form.account_number))    {       alert('You have not entered an account number')       form.account_number.focus();       return false;    }    if (!IsNumeric(form.account_number.value))    {       alert('Please enter only numbers or decimal points in the account field')       form.account_number.focus();       return false;       } return true; }