Thanks for the ideas. Interesting idea, disabling the fields out of
view, but my scenario actually has a series of forms (like 6 of them),
so that'd seem like a bit much for my case.
Here's what I ended up doing (which amounted to disabling the tab for
the relevant fields):
1. created this plugin:
(function($) {
$.fn.preventTab = function(options) {
return this.each(function(){
$(this).bind('keydown', function(e){
if(e.which == 9){
return false;
}
});
});
};
})(jQuery);
2. added this to form fields that the tabbing went to before going to
the next slide:
class="preventTab"
3. wired up the plugin by doing this:
$('.preventTab', $myContext).preventTab();
The rub is that it disables shift-tab as a result, so once the user goes
into that field, they can't shift-tab back out. It also doesn't take
care of shift-tabbing from the first form field to one in a previous
slide (unless I apply it to that field, too, in which case tabbing
forward from it won't work). I did a little googling to see how best to
handle/detect shift-tab, but so far am not sure (other than maybe to use
the jquery hotkeys plugin, which I've already got in the project anyway.
Thanks,
Jack
Brendan wrote:
Set tabindexes and hope for the best? Other than maybe disabling the
tab key altogether i'm not sure if you can. How about disabling the
fields until they come into view?
On Jun 2, 4:16 pm, Jack Killpatrick <j...@ihwy.com> wrote:
Anyone have any ideas? TIA.
- Jack
Jack Killpatrick wrote:
Hi,
Does anyone know of a way to prevent tabbing (via keyboard tab key)
between form fields in different "slides" when using the jquery
scrollTo plugin? For example, I have a UL with 2 LI's in it and each
LI has a <form> inside of it. If a user is on slide 1 and hits tab on
the last visible form field, the first form field on the next slide
comes into view (because the browser gives it focus), thus moving
slide 2 partially into view. The same kind of thing happens from slide
2 to slide 1 when shift-tabbing (tabbing backwards): a form field on
slide 1 gets focused and comes into view.
I'd like to prevent tabbing between the forms. To complicate matters a
bit more (possibly), one of my forms has a jquery UI tab control on
it, so the last visible form field could be any field on any of the
tab control's tabs (ie: the "last" visible form field depends on what
tab is showing.
I tried a few things, but nothing jumped out as a good solution. Any
ideas?
Thanks,
Jack