This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
Phone Number Section Advance
Started 14 years ago by MarioCipriano | 2 posts |
-
I would like to know if when entering a phone number the courser can advance to the next field when the area code has received 3 characters, and so on with the rest of the numbers.
Posted 14 years ago # -
Do you mean with auto tab ? If so, you need to edit "includes/view-functions.php" file for this and try to follow these steps :
1. Go to line 1825 for this code :
$form_markup = <<<EOT
and put javascript code exactly above that line like this :
if ($_GET['id'] == 9) { $custom_js =<<<EOT <script type="text/javascript" src="js/jquery/jquery-core.js"></script> <script type="text/javascript"> function autoTab(field1, len, field2) { if (document.getElementById(field1).value.length == len) { document.getElementById(field2).focus(); } } $('document').ready(function() { $('#element_1_1').attr('autocomplete','off'); $('#element_1_2').attr('autocomplete','off'); $('#element_1_1').keyup(function () { autoTab('element_1_1',3,'element_1_2'); }); $('#element_1_2').keyup(function () { autoTab('element_1_2',3,'element_1_3'); }); }); </script> EOT; }
2. Go to around line 1871, you'll see this code :
{$calendar_js}
then change it to
{$custom_js} {$calendar_js}
In there I assume your form ID is 9 and the phone field has these elements (element_1_1, element_1_2, element_1_3). You need to change those ID's in that script with yours.
MachForm Support
Posted 14 years ago #
Reply
You must log in to post.