The error message seems to indicate that:

elem = document.getElementById(destination);

is not returning a valid reference to field 'ssn2', which seems strange. Rather than showing us the JSF code, how about letting us look at the generated HTML?

----- Original Message ----
From: Nick Arndt <nick.arndt@xxxxxxxxx>
To: Web Enabling the AS400 / iSeries <web400@xxxxxxxxxxxx>
Sent: Monday, April 27, 2009 1:42:09 PM
Subject: [WEB400] auto tab between jsf form fields

Hi all I am having some trouble getting this to work.

I am getting an error Elem is null or not an object.

here is my java script:

function autotab(original,destination)

if (document.all) // if IE

if (event.keyCode == 9 || //tab
event.keyCode == 16 || //backtab
event.keyCode >= 37 && event.keyCode <= 40 || //arrow keys
event.keyCode == 45 || //insert
event.keyCode == 46 || //delete
event.shiftKey) //shift
{ return } // no autotab on tab/backtab/insert/delete/shift

elem = document.getElementById(destination);

and here is my jsf code that is invoking the function:

styleClass="inputText" id="ssn1"
onkeyup="autotab(this, 'ssn2');"
<hx:validateConstraint regex="^[0-9]+$"

<h:inputText styleClass="inputText" id="ssn2"
size="2" onkeyup="autotab(this,'ssn3');"

<h:inputText styleClass="inputText" id="ssn3"
size="4" maxlength="4">
<hx:validateConstraint regex="^[0-9]+$"


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.