I believe this is for the onLoad() that you use in the <BODY> tag. 

   Is there any proposal as to include this in the 1.1 (or) 1.0 version of
struts ? Basically everytime a jsp page is called, the onLoad() method is
called which send the focus to the first error (if any exists). With my
previous client, we used a javascript pop-up window to display the errors
rather than display in the same page (and mess up the outlay of the page).
When the user closes the error window, the focus is shifted to the first
error field.

Any suggestions/comments on this are welcome.


cheers,
Amar..


-----Original Message-----
From: Anderson, Jessica [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 10:35 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Anyway to onFocus without Javascript?


is the event for this onLoad? or something else?

-----Original Message-----
From: Nanduri, Amarnath [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 08, 2001 7:40 AM
To: '[EMAIL PROTECTED]'
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:[EMAIL PROTECTED]]
Sent: Wednesday, March 07, 2001 10:05 PM
To: [EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> 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
>
>

Reply via email to