Form validation in tabbar

I have 2 tabs, Tab 1 and Tab 2.
Tab 1 contains text box FF1, FF2 and FF3
Tab 2 contains text box FF4, FF5 and a submit button.

On clicking submit button, I’m trying to validate text box FF1 in Tab 1 but I got an error message
“Message: Can’t move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus.”

How do I resolve this problem. Appreciate help from Support.

<form name="form1" method="post">
<body>
	<div id="a_tabbar" hrefmode="iframes-on-demand" class="dhtmlxTabBar" imgpath="dhtmlx/dhtmlxTabbar/codebase/imgs/" style="width:100%;height:100%;">
		<div id="a1" name="Tab 1" width="100%" height="100%">
			<table cellpadding="20" cellspacing="0" height="100%" width="100%">
			<tr>
				<td align="center" valign="top">
					<table border="0" width="100%" height="100%">
						<tr>
							<td class="label">Row 1</td>
							<td align="left"><input type="text" name="FF1" size="45"></td>
						</tr>
						<tr>
							<td class="label">Row 2</td>
							<td align="left"><input type="text" name="FF2" size="45"></td>
						</tr>
						<tr>
							<td class="label">Row 3</td>
							<td align="left"><input type="text" name="FF3" size="45"></td>
						</tr>
					</table>
				</td>
			</tr>
			</table>
		</div>
		<div id="a2" name="Tab 2" width="100%" height="100%">
			<table cellpadding="20" cellspacing="0" height="100%" width="100%">
			<tr>
				<td align="center" valign="top">
					<table border="0" width="100%" height="100%">
						<tr>
							<td class="label">Row 4</td>
							<td align="left"><input type="text" name="FF4" size="45"></td>
						</tr>
						<tr>
							<td class="label">Row 5</td>
							<td align="left"><input type="text" name="FF5" size="45"></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td class="label">&nbsp;</td>
				<td align="left">
					<input type="submit" value="Submit" onclick="return onSubmit()">
				</td>
			</tr>       
			</table>
		</div>
	</div>
</body>
</form>

<script>
	function onSubmit()
	{
		if (document.form1.FF1.value == '')
		{
			alert("Empty");
			document.form1.FF1.focus();
                        return false;
		}
	}
</script>

Try to make tab active and then set focus:

[code]function onSubmit()
{
if (document.form1.FF1.value == ‘’)
{
a_tabbar.setTabActive(“a1”);

      document.form1.FF1.focus();
      return false;
  }

}[/code]