FYI: I checked into how Struts renders <html:form focus="fieldName"
...>, and it simply adds the following lines after the end of the form:

<script language="JavaScript" type="text/javascript">
  <!--
 
document.forms["viewName:formName"].elements["viewName:formName:fieldNam
e"].focus();
  // -->
</script>

Is that something we can build into a <t:form> component?  Does anyone
know whether something like this will be in the next standard for
<h:form>?

I'll submit a JIRA suggested enhancement for this, since I believe it
could be quite useful.

- Brendan

>  -----Original Message-----
> From:         CONNER, BRENDAN (SBCSI)  
> Sent: Thursday, October 20, 2005 10:03 AM
> To:   'MyFaces Discussion'
> Subject:      Help!  How to set focus on a form?
> 
> Under Struts, one could do the following: <html:form ....
> focus="fieldName"> to specify which field within a form should receive
> focus upon loading the form.  How can I do this under JSF?
> 
> - Brendan

Reply via email to