All that the "focus" attribute does is to write some JavaScript for you.
There's nothing wrong with writing your own JavaScript after your form.
Here's a sample of what it writes:
<script type="text/javascript">
var focusControl = document.forms["searchForm"].elements["arrivalDate"];
if (focusControl.type != "hidden") {
focusControl.focus();
}
</script>
Feel free to modify for your needs...
Matt
-----Original Message-----
From: muzammil shahbaz [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 5:23 AM
To: [EMAIL PROTECTED]
Subject: Setting focus in struts html form
I am getting trouble in setting focus in Struts <html:form>. There are
two possibilities in my case; in one scenario text field 'A' in form
exists while in other scenario it does not. I want to set focus on 'A'
if it exists. For that simply, I write focus="A". But it gives
javascript error when this field does not exist.
The statement below doesnot accept any scriptlet, so that I may choose
when to put focus and when not. I am using Struts 1.0 and find no way of
dynamic setting focus in form.
<html:form action="submitProfile.do" method="post" focus="A" >
I will appreciate your kind response in this regard. Thanks in advance.
MMS
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]