You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by TI...@ngco.com on 2001/04/05 15:30:27 UTC

MOVEING CURSOR INTO THE ERROR FIELD.

Hi,
I 'am using staruts for a small pilot project.
On the form bean when validate method collect errors and shows in JSP,
I want at the same time my cursor should move to the first error field. how
I can acheive this.. 
does anybody knows about this...

Thanks N Regards

TAHIR IQBAL
 Information Services Division (ISD)
 Loblaw Companies Limited
 6 Monogram Place
 Weston, ON - M9R 4CR
*	416-246-7831
 Email	TIQBAL@NGCO.COM						"Stay Cool
And U'll Rule"



Re: MOVEING CURSOR INTO THE ERROR FIELD.

Posted by Rob Leland <Ro...@freetocreate.org>.
There is a method something like:
<html:errors property="firstName"/>

TIqbal@ngco.com wrote:
> 
> Hi,
> I 'am using staruts for a small pilot project.
> On the form bean when validate method collect errors and shows in JSP,
> I want at the same time my cursor should move to the first error field. how
> I can acheive this..
> does anybody knows about this...
> 
> Thanks N Regards
> 
> TAHIR IQBAL
>  Information Services Division (ISD)
>  Loblaw Companies Limited
>  6 Monogram Place
>  Weston, ON - M9R 4CR
> *       416-246-7831
>  Email  TIQBAL@NGCO.COM                                         "Stay Cool
> And U'll Rule"

Re: MOVEING CURSOR INTO THE ERROR FIELD.

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 5 Apr 2001 TIqbal@ngco.com wrote:

> Hi,
> I 'am using staruts for a small pilot project.
> On the form bean when validate method collect errors and shows in JSP,
> I want at the same time my cursor should move to the first error field. how
> I can acheive this.. 
> does anybody knows about this...
> 

One approach to consider is to remember that the "focus" attribute of the
form can take a runtime expression, instead of a String constant, to
specify the name of the field to send the cursor to.  If you had some
mechanism to define a bean (with a string value) named "errorField" then
you could say:

	<jsp:useBean id="errorField" class="java.lang.String"/>
	<form action="/xxx" focus="<%= errorField %>">
	  ...
	</form>

> Thanks N Regards
> 
> TAHIR IQBAL
>  Information Services Division (ISD)
>  Loblaw Companies Limited
>  6 Monogram Place
>  Weston, ON - M9R 4CR
> *	416-246-7831
>  Email	TIQBAL@NGCO.COM						"Stay Cool
> And U'll Rule"
> 
> 
> 
Craig