1 field easy Javascript or AJAX form validation.
Summary:
I need to validate a single phone number field in a Paypal checkout form.
10 digits need to be entered in correct format for the form to continue.
10 digits need auto formatting during input.
Numbers entered would be checked against a list of possible correct numbers.
Needs on screen error message and also pop up message box.
Details:
Number field only allows the number in this format: 08-XXXX-XXXX. Requires 10 digits. 2 hyphens
Error for not 10 digits: "Please enter your 10 Digit number starting with 08." (Form can not submit without a number in 10-digit format.) Please make this an onscreen error message next to the input box.
Script should auto add the hyphen "-" at spot 3, and 8 during a users input.
Please check the number begins with one of the numbers in the list below. If so, ok.
If not, text display: "This service is only for AIS 1-2 Call. Are you sure your number is correct?" This would be pop up warning dialog box.
Cancel: return to page
OK: submit the form
Notes:
This script will need to run on a Word Press page.
If you can stylize, would like to double the size of the input fields.
First person to post to a completed script would be chosen as the project winner.
Price expected: $30-50
This is the form:
<form action="[login to view URL]" method="post"> <input name="cmd" type="hidden" value="_s-xclick" />
<input name="hosted_button_id" type="hidden" value="T48RXCJABBQQJ" />
<table>
<tbody>
<tr>
<td><input name="on0" type="hidden" value="Credit Amount" />Credit Amount</td>
</tr>
<tr>
<td><select name="os0"> <option value="100 Baht">100 Baht $5.99</option> <option value="200 Baht">200 Baht $9.50</option> <option value="300 Baht">300 Baht $12.99</option> <option value="400 Baht">400 Baht $16.50</option> <option value="500 Baht">500 Baht $19.99</option> <option value="800 Baht">800 Baht $29.99</option> </select></td>
</tr>
<tr>
<td><input name="on1" type="hidden" value="AIS 12Call Phone Number:" />AIS 12Call Phone Number:</td>
</tr>
<tr>
<td><input maxlength="10" name="os1" type="text" value="08" /></td>
</tr>
</tbody>
</table>
<input name="currency_code" type="hidden" value="USD" />
<input alt="PayPal - The safer, easier way to pay online!" name="submit" src="[login to view URL]" type="image" />
<img src="[login to view URL]" border="0" alt="" width="1" height="1" />
These are the numbers to check for:
080-00xxxx
081-0xxxxxx -___________
081-170xxxx ~ 081-199xxxx
081-250xxxx ~ 081-299xxxx
081-350xxxx ~ 081-389xxxx
081-700xxxx ~ 081-709xxxx
081-720xxxx ~ 081-799xxxx
081-8xxxxxx -___________
081-9xxxxxx -___________
086-0xxxxxx -___________
086-1xxxxxx -___________
086-2xxxxxx -___________
087-0xxxxxx -___________
087-1xxxxxx -___________
087-2xxxxxx -___________
089-0xxxxxx -___________
089-2xxxxxx -___________
089-5xxxxxx -___________
089-8xxxxxx -___________
089-9xxxxxx -___________