Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 3554032

Browse files
committed
Merge pull request #50 from Mathachew/dev
Changes for release 1.7
2 parents c278f5c + 9381735 commit 3554032

File tree

7 files changed

+246
-140
lines changed

7 files changed

+246
-140
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
## 1.7 (2014-07-26)
2+
3+
Features:
4+
5+
* added support for additional fields and removed hidden fields from the selected elements, including maxlength support for textarea (#14)
6+
* added option to auto tab on single value select lists when selecting a value
7+
* added global methods to setup, remove and restore Autotab
8+
* elements passed to Autotab now filter out hidden form fields
9+
10+
Bug fixes:
11+
12+
* fixes an issue with tabbing to a previous field that is disabled, resulting in the value being modified (#47)
13+
14+
115
## 1.6 (2014-04-30)
216

317
Features:

README.md

Lines changed: 63 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Autotab is a jQuery plugin that provides auto tabbing and filtering on text fiel
2222
* [Examples](#examples-1)
2323
* [Filtering](#filtering)
2424
* [Examples](#examples-2)
25-
* [Forced Auto Tabbing](#forced-auto-tabbing)
25+
* [Global Methods](#global-methods)
2626
* [Options](#options)
2727
* [Filter Formats](#filter-formats)
2828
* [Minify](#minify)
@@ -237,7 +237,7 @@ Manually defines number filtering via `data-autotab-format`. In this example, `$
237237
Other random JavaScript examples
238238

239239
```js
240-
$('input[type=text]').autotab();
240+
$(':input').autotab();
241241
$('#username').autotab({ format: 'alphanumeric', target: '#password' });
242242
$('#password').autotab({ previous: '#username', target: '#confirm' });
243243
$('#product-key').autotab('filter', { format: 'alphanumeric', uppercase: true });
@@ -248,20 +248,65 @@ $('.ipv6').autotab('filter', 'hexadecimal');
248248
```
249249

250250

251-
### Forced Auto Tabbing
251+
### Global Methods
252252

253-
Autotab comes with two functions that can be used to force an auto tab from a field if a criteria is met.
254-
255-
__Note__: These methods are only useful if an element setup with Autotab has focus.
253+
Autotab comes with several global methods, which are probably most useful in edge cases.
256254

255+
<table width="100%">
256+
<tr>
257+
<td width="30%" valign="top">$.autotab()</td>
258+
<td>Initializes Autotab on all elements matching the `:input` selector.</td>
259+
</tr>
260+
<tr>
261+
<td valign="top">$.autotab(object)</td>
262+
<td><strong>object</strong>: Applies the specified options to all matched elements.
263+
</td>
264+
</tr>
265+
</table>
257266
<table width="100%">
258267
<tr>
259268
<td width="30%" valign="top">$.autotab.next()</td>
260-
<td>Triggers the `autotab-next` event, which sets the focus on the target element, if it exists.</td>
269+
<td>
270+
Triggers the `autotab-next` event, which sets the focus on the target element, if it exists.
271+
<br />
272+
<strong>Note</strong>: This method is only useful if an element setup with Autotab has focus.
273+
</td>
261274
</tr>
262275
<tr>
263276
<td valign="top">$.autotab.previous()</td>
264-
<td>Triggers the `autotab-previous` event, which sets the focus on the previous element, if it exists.</td>
277+
<td>
278+
Triggers the `autotab-previous` event, which sets the focus on the previous element, if it exists.
279+
<br />
280+
<strong>Note</strong>: This method is only useful if an element setup with Autotab has focus.
281+
</td>
282+
</tr>
283+
</table>
284+
<table width="100%">
285+
<tr>
286+
<td width="30%" valign="top">$.autotab.remove()</td>
287+
<td>Removes Autotab from all matched elements.</td>
288+
</tr>
289+
<tr>
290+
<td valign="top">$.autotab.remove(string)</td>
291+
<td><strong>string</strong>: A selector identifying the matched element.</td>
292+
</tr>
293+
<tr>
294+
<td valign="top">$.autotab.remove(object)</td>
295+
<td><strong>object</strong>: Applies the removal to all matched elements.</td>
296+
</tr>
297+
</table>
298+
<table width="100%">
299+
<tr>
300+
<td width="30%" valign="top">$.autotab.restore()</td>
301+
<td>Restores Autotab to all matched elements.</td>
302+
</tr>
303+
<tr>
304+
<td valign="top">$.autotab.restore(string)</td>
305+
<td><strong>string</strong>: A selector identifying the matched element.</td>
306+
</tr>
307+
<tr>
308+
<td valign="top">$.autotab.restore(object)</td>
309+
<td><strong>object</strong>: Applies restoration to all matched elements.</td>
265310
</tr>
266311
</table>
267312

@@ -278,7 +323,8 @@ var options = {
278323
maxlength: integer,
279324
target: string|element,
280325
previous: string|element,
281-
trigger: string|array
326+
trigger: string|array,
327+
tabOnSelect: boolean
282328
};
283329
```
284330
<table width="100%">
@@ -358,6 +404,12 @@ var options = {
358404
</td>
359405
</td>
360406
</tr>
407+
<tr>
408+
<td valign="top">tabOnSelect</td>
409+
<td>
410+
<strong>boolean</strong>: Adds auto tabbing to all matched single value select lists.
411+
</td>
412+
</tr>
361413
</table>
362414

363415

@@ -413,7 +465,7 @@ Autotab has several filter formats available, all passed into the `format` key.
413465

414466
## Minify
415467

416-
Autotab uses the [samqode minifier](http://samqode.com/minifyjs) (`simple` optimization) to create jquery.autotab.min.js.
468+
Autotab uses the [Closure Compiler](http://closure-compiler.appspot.com/) (`simple` optimization) to create jquery.autotab.min.js.
417469

418470

419471
## Feedback
@@ -424,6 +476,6 @@ You can also reach out to me on twitter: [@mathachew](http://www.twitter.com/mat
424476

425477
## Copyright and license
426478

427-
&copy; 2013 Matthew Miller
479+
&copy; 2014 Matthew Miller
428480

429481
Licensed under the MIT licensing: http://www.opensource.org/licenses/mit-license.php

autotab.jquery.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"filter",
77
"autotab"
88
],
9-
"version": "1.6",
9+
"version": "1.7",
1010
"author": {
1111
"name": "Mathachew",
1212
"url": "https://github.com/Mathachew"

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery.autotab",
3-
"version": "1.6",
3+
"version": "1.7",
44
"description": "A jQuery plugin that provides auto-tabbing and filtering on text fields in a form.",
55
"main": [ "./js/jquery.autotab.min.js" ],
66
"homepage": "https://github.com/Mathachew/jquery-autotab",

demo.html

Lines changed: 48 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
<head>
55
<title>jQuery Autotab Demo</title>
66
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7-
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
7+
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
88
<script src="js/jquery.autotab.js"></script>
99
<script>
1010
$(function () {
11-
$('input[type=text], input[type=password]').autotab();
11+
$.autotab({ tabOnSelect: true });
1212
$('.number').autotab('filter', 'number');
13-
$('.ssn').autotab('filter', 'number');
1413
$('.text').autotab('filter', 'text');
1514
$('.alpha').autotab('filter', 'alpha');
1615
$('.alphanumeric').autotab('filter', { format: 'alphanumeric', uppercase: true });
@@ -41,17 +40,20 @@
4140
});
4241
$('.hexadecimal').autotab('filter', 'hexadecimal');
4342
$('.ip').autotab('filter', { format: 'number', trigger: '.' });
44-
$('.pin').autotab('filter', { format: 'number' });
43+
$('.pin').autotab('filter', 'number');
4544

4645
$('#remove-autotab').on('click', function () {
47-
$('input[type=text]').autotab('remove');
46+
$.autotab.remove();
4847
$('#autotab-status span').removeClass('on').addClass('off').text('Off');
4948
});
5049

5150
$('#restore-autotab').on('click', function () {
52-
$('input[type=text]').autotab('restore');
51+
$.autotab.restore();
5352
$('#autotab-status span').removeClass('off').addClass('on').text('On');
5453
});
54+
55+
$('').on('click', function () {
56+
});
5557
});
5658
</script>
5759

@@ -104,7 +106,7 @@
104106
display: inline-block;
105107
font-size: 14px;
106108
margin: 10px 0;
107-
outline: none;
109+
/*outline: none;*/
108110
padding: 6px 12px;
109111
position: relative;
110112
text-align: center;
@@ -129,7 +131,11 @@
129131
<body>
130132
<div id="container">
131133
<h1>jQuery Autotab Demo</h1>
132-
<p>Autotab's documentation can be found in <a href="https://github.com/Mathachew/jquery-autotab/blob/master/README.md">ReadMe.md</a> on GitHub.</p>
134+
<p>Autotab's full documentation can be found in <a href="https://github.com/Mathachew/jquery-autotab/blob/master/README.md">ReadMe.md</a> on GitHub.</p>
135+
136+
<hr />
137+
138+
<p><strong>Note:</strong> For the purposes of this demo, I am calling <code>$.autotab()</code> to initialize the auto tabbing order.</p>
133139

134140
<hr />
135141

@@ -154,44 +160,7 @@ <h1>jQuery Autotab Demo</h1>
154160
<input type="text" id="number3" class="number" maxlength="4" size="5" />
155161
</div>
156162
<pre>
157-
// Example 1
158-
$('input[type=text]').autotab();
159-
$('.number').autotab('filter', 'number');
160-
161-
// Example 2
162-
$('.number').autotab();
163163
$('.number').autotab('filter', 'number');
164-
165-
// Example 3
166-
$('#number1').autotab({ format: 'number', target: '#number2' });
167-
$('#number2').autotab({ format: 'number', target: '#number3', previous: '#number1' });
168-
$('#number3').autotab({ format: 'number', target: '#ssn1', previous: '#number2' });
169-
170-
// Example 4
171-
// Note: Applies number formatting to all elements, but the last element lacks a target
172-
$('.number').autotab({ format: 'number' });
173-
$('#number3').autotab({ target: '#ssn1' });
174-
</pre>
175-
</div>
176-
177-
<div>
178-
<p>Examples from this point on will assume <code>$('input[type=text]').autotab()</code> is called.</p>
179-
</div>
180-
181-
<hr />
182-
183-
<div>
184-
<div class="example">
185-
<label for="ssn1">Social Security Number</label>
186-
187-
<input type="text" id="ssn1" class="ssn" maxlength="3" size="3" />
188-
-
189-
<input type="text" id="ssn2" class="ssn" maxlength="2" size="3" />
190-
-
191-
<input type="text" id="ssn3" class="ssn" maxlength="4" size="5" />
192-
</div>
193-
<pre>
194-
$('.ssn').autotab('filter', 'number');
195164
</pre>
196165
</div>
197166

@@ -256,28 +225,6 @@ <h1>jQuery Autotab Demo</h1>
256225

257226
<hr />
258227

259-
<div>
260-
<div class="example">
261-
<label for="all1">Any and all characters</label>
262-
263-
<input type="text" id="all1" class="all" maxlength="5" size="4" />
264-
-
265-
<input type="text" id="all2" class="all" maxlength="5" size="4" />
266-
-
267-
<input type="text" id="all3" class="all" maxlength="5" size="4" />
268-
-
269-
<input type="text" id="all4" class="all" maxlength="5" size="4" />
270-
-
271-
<input type="text" id="all5" class="all" maxlength="5" size="4" />
272-
</div>
273-
<pre>
274-
// Note: This call is not necessary as 'all' is the default format
275-
$('.all').autotab('filter', 'all');
276-
</pre>
277-
</div>
278-
279-
<hr />
280-
281228
<div>
282229
<div class="example">
283230
<label for="regex">Regular Expression (Allows numbers and periods)</label>
@@ -292,7 +239,7 @@ <h1>jQuery Autotab Demo</h1>
292239

293240
<div>
294241
<div class="example">
295-
<label for="function">Custom Function (Range of 1-12, even if the second digit is greater than 2)</label>
242+
<label for="function">Custom Function that forces a number range of 1 to 12</label>
296243
<input type="text" id="function" maxlength="2" size="3" />
297244
</div>
298245
<pre>
@@ -380,7 +327,39 @@ <h1>jQuery Autotab Demo</h1>
380327
<input type="password" id="pin2" class="pin" maxlength="3" size="4" />
381328
</div>
382329
<pre>
383-
$('.pin').autotab('filter', { format: 'number' });
330+
$('.pin').autotab('filter', 'number');
331+
</pre>
332+
</div>
333+
334+
<hr />
335+
336+
<div>
337+
<div class="example">
338+
<label for="all1">Any and all characters with tabbing support on non-text form fields. Textarea will auto tab when the defined <code>maxlength</code> is reached, disabled fields are skipped entirely, and the select list will auto tab when a value is selected. Auto tabbing on select lists only applies for single select and is configurable using <code>tabOnSelect</code>.</label>
339+
340+
<input type="text" id="all1" class="all" maxlength="5" size="4" />
341+
<input type="text" id="all2" class="all" maxlength="3" size="1" disabled="disabled" value="zxy" />
342+
<input type="text" id="all3" class="all" maxlength="5" size="4" />
343+
<br />
344+
<button value="button">Standard Button</button> <input type="submit" value="Submit Button" /> <button value="button" disabled="disabled">Disabled Button</button>
345+
<br />
346+
<select>
347+
<option>First</option>
348+
<option>Second</option>
349+
<option>Third</option>
350+
</select>
351+
<br />
352+
<input type="radio" name="radio" />
353+
<br />
354+
<input type="checkbox" />
355+
<br />
356+
<textarea cols="20" rows="2" maxlength="10" class="all"></textarea>
357+
<br />
358+
<input type="text" id="all4" class="all" maxlength="5" size="4" />
359+
</div>
360+
<pre>
361+
// Note: This call is not necessary as 'all' is the default format
362+
$('.all').autotab('filter', 'all');
384363
</pre>
385364
</div>
386365
</div>

0 commit comments

Comments
 (0)