struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anderson, Jessica" <Jessica.Ander...@trs.state.tx.us>
Subject RE: Anyway to onFocus without Javascript?
Date Thu, 08 Mar 2001 15:35:29 GMT
is the event for this onLoad? or something else?

-----Original Message-----
From: Nanduri, Amarnath [mailto:Amarnath.Nanduri@Agilquest.com]
Sent: Thursday, March 08, 2001 7:40 AM
To: 'struts-user@jakarta.apache.org'
Subject: RE: Anyway to onFocus without Javascript?



I believe that if we use javascript it can be done. When struts shows the
previous page with errors in it, using javascript we can send the focus to
the first error field in the group. I believe that i have done something
similar to this with my previous client. Basically we used jsp tags to get
the first error field (out of the error object) and send focus to it.

  // pseudo syntax

  if(errors exist)
  document.form.<%= errorBean.getFirstError() %>.focus 

p.s Please excuse my bad javascript syntax. I am not that good with
Javascript.

cheers,
Amar..


-----Original Message-----
From: Eric Rasmussen [mailto:eric@websidestory.com]
Sent: Wednesday, March 07, 2001 10:05 PM
To: struts-user@jakarta.apache.org
Subject: Re: Anyway to onFocus without Javascript?


Well, there is, but I don't think this answers the original question.

You can use the focus attribute of the html:form tag:
    <html:form action="[action]" focus="[name of field to focus on]">

Alas, this will make it so that that field is always focussed on, not the
field that gave the error.  I am not sure if that is possible.

    - eric

----- Original Message -----
From: "William Jaynes" <wjaynes@mediaone.net>
To: <struts-user@jakarta.apache.org>
Sent: Wednesday, March 07, 2001 2:02 PM
Subject: Re: Anyway to onFocus without Javascript?


> Sorry, Jessica,
> There is no way to focus on to an html field without using JavaScript.
>
> ----- Original Message -----
> From: "Anderson, Jessica" <Jessica.Anderson@trs.state.tx.us>
> To: <struts-user@jakarta.apache.org>
> Sent: Wednesday, March 07, 2001 10:31 AM
> Subject: Anyway to onFocus without Javascript?
>
>
> > Does Struts provide any mechanism for focusing on a text field in the
event
> > that the field did not pass validation - WITHOUT using Javascript?  Not
sure
> > if this is possible...thought i'd ask.
> > Thanks,
> > Jessica
>
>

Mime
View raw message