You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Paul Idusogie <Pa...@stellent.com> on 2002/03/11 23:52:28 UTC

javascript appearing before object is created.

Could any provide a workaround?



I used the html:form tag syntax in a logon.jsp page with the following syntax
<html:form action="/logon.do" focus="userName">
	.....
</html:form>

This will add the javascript portion to set the form username attribute on focus when the page is launched. However I receive the following error:
'document.form.userName is null or not an object'

with IE 5.X. 

The javascript script appears before the rest of the form attributes when I view the generated code using view source. It looks like this:

<form name="aFormName" method=POST action="/anAction.do">
	<script language="javascript" >
	<!--
		document.forms["aformName"].elements["userName"].focus()
	// -->
	</script>
	<table>
		<tr>
			<td>UserName:</td>
			<td><input type=text size=16 name=userName value=""></td>
		</tr>
			....
	</table>
</form>

This error occurs probably because IE executes the javascript portion before the page is painted. Any remedies, Please.

Thanks,

Paul Idusogie 
Technical Architect 
Consulting Services
Stellent Inc.
7777 Golden Triangle Drive
Eden Prairie, MN 55104
Desk: 952.656.2755
Fax: 952.903.2115
Email: paul.idusogie@stellent.com
website: http://www.stellent.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>