Salesforce Web-to-lead issue with posting phone number - salesforce

I've tried each of the variations below and get the following error,
Salesforce could not create this lead because of the reason listed below. For more information about this error or help with Web-to-Lead, please contact Customer Support.
Reason: Only Numbers are allowed in Phone number.
I'm only using numbers so I'm not sure what the issue is. My coding is very limited, but I feel like this should be an easy fix.
<label for="phone">Phone</label><input id="phone" maxlength="40" name="phone" size="20" type="phoneNumber" />
<label for="phone">Phone</label><input id="phone" maxlength="40" name="phone" size="20" type="Number" />
<label for="phone">Phone</label><input id="phone" maxlength="40" name="phone" size="20" type="text" />
<label for="phone">Phone</label><input id="phone" maxlength="40" name="phone" size="20" type="tel" />

Out of the box Salesforce is relaxed about phone numbers. They're essentially Text(40) fields, you can put + signs, spaces, extensions...
Your administrator has put a validation rule on the field that throws when there are any characters other than 0-9 range. (There might be more code validations hidden, you'd need to check debug logs)
What are you entering? The way this validation's written I think it'll also throw if the field is blank.

Related

How to use OR with ng-pattern

Here is my Input field where I am using ng-pattern
<input class="form-control" type="text" name="name"
ng-pattern="/(^[A-z]+$) | (^[0-9]*$)/"
required="" ng-model="name"/>
Input from the user should be either a number or alphabets. How to use OR(|) operator with ng-pattern?
Following are valid inputs :
123 (All numbers)
abc (All alphabets)
Following are invalid inputs :
a1
.tgh7
I think you can just combine your two current regex patterns into a single pattern:
<input class="form-control" type="text" name="name"
ng-pattern="/(^([A-z]+|[0-9]+)$)/"
required="" ng-model="name" />
This approach might outperform what you currently have, because it requires evaluating only a single regex pattern, instead of two patterns.
Follow the link below for a demo of the regex:
Regex101

ng-pattern for only hebrew characters

I want to use ng-pattern validate my text input field that should accept only Hebrew characters, sometimes the input are ok and sometimes they are being rejected for some reason. (the first one is validate the second letter is not and etc.)
example:
<input type="text" class="form-control" name="firstName" ng-model="Join.firstName" id="firstName" aria-describedby="firstNameHelp" maxlength="15" ng-pattern="onlyHebrewPattern" required>
and the solution that given was:
scope.onlyHebrewPattern = /^[\u05D0-\u05F3]+$/g;
original post
$scope.onlyHebrewPattern = /^[א-ת\s]+$/;

input type number does not add any constraint even set ng-step

I am using input type number and want to allow user only integer value between 1-10 so added ng-step="1" but it still allow float and giving no error
<input type="number"
ng-step="1"
ng-min="1"
ng-max="10"
name="numKeys"
ng-model="vm.data.numKeys"
ng-required class="form-control" />
see this demo
Use ng-pattern with the RegExp "/^[0-9]+$/" to accept only integer values.
<input type="text" ng-model="value" ng-pattern="/^[0-9]+$/">
this just solve my problem
<input type="text" name="numKeys" ng-pattern="/^([1-9]|10)$/" required />

Angular: better form validation solution

Need advice about form validation.
I have control structure like so:
<form name="myForm">
<control-wrap>
<label isRequired="myForm.field1">Some text here</label>
<custom-control name="field1"
ng-required="true"
ng-something-else="any"
ng-model="modelForm.field1"></custom-control>
<info>Some data after control</info>
<error-list field="myForm.field1"></error-list>
</control-wrap>
<control-wrap>
<label isRequired="myForm.field2">Some text here</label>
<custom-control name="field2"
ng-required="true"
ng-something-else="any"
ng-model="modelForm.field2"></custom-control>
<info>Some data after control</info>
<error-list field="myForm.field2"></error-list>
</control-wrap>
<control-wrap>
<label isRequired="myForm.field3">Some text here</label>
<custom-control name="field3"
ng-required="true"
ng-something-else="any"
ng-model="modelForm.field3"></custom-control>
<info>Some data after control</info>
<error-list field="myForm.field3"></error-list>
</control-wrap>
</form>
And this is completely AWFUL, unDRY and I guess I'm doing something very wrong.
I want to stop using field names, but I don't know how to pass ngModel to the sibling the proper way (now I'm forced to pass ngModel via attributes to isRequired and error-list).
Best solution for me ofc is to require: '^ngModel' from isRequired and error-list.
Any advice will be very appreciated.
P.S. there is no way for me to store fields in json object, there is a lot of logic between fields and different tweaks on labels and hints.
Well, I came to this solution: https://plnkr.co/edit/mPXpEaZs2uWZb3WRkmgp?p=preview
Maybe it's not the best solution, but I don't need names anymore.
The main idea is to set model reference to parent container and watch this reference from other children.
So in the end I have:
<control-wrap>
<label link-required>Field1 label:</label>
<input link-to-wrap ng-model="mc.field1"
type="text"
ng-required="true"
ng-minlength="5"
ng-maxlength="10" />
<errors-list></errors-list>
</control-wrap>
UPDATE
Some more thoughts about storing validation rules with model:
https://plnkr.co/edit/6ZVv685oSRDt7ELBKb9z?p=preview
New directive my-rules and extended data in controller.js

how to check whether my text field is allowing more than 15 characters or not in protractor for angular js app

I have a text field.If the entered character limit exceeds 15 ,I have to check whether it is showing the correct error message or not.
It's unclear your question but if you need to show the right error you need something like this:
<form name="formName">
<input fr-validate type="text" name="Name" class="form- control border-radius-0" ng-maxlength="15" ng-model="FirstName" />
<p ng-show="formName.Name.$error.maxlength">Name is too long</p>
</form>
The p will be show if you exceed the length.

Resources