Hmmmmms sounds nifty but how would I then display an error message as
well????

The more I use JS the more I like it

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Vance Heredia
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> -----Original Message-----
> From: Steve Vanspall [mailto:[EMAIL PROTECTED] 
> Sent: Monday, 11 August 2003 1:25 PM
> To: Struts Users Mailing List
> Subject: RE: How to return to form element
> 
> 
> Well I dont know of any easy way to do it
> 
> but you could probably make use of the action errors somehow.
> 
> maybe create, in your message resurces file, a piece of 
> javascript that dynamically set the name of the field to be 
> focused on. Then the onload function would focus on it for 
> you. Sounds a bit complicated but would go something like this.
> 
> -- if form validate --
> boolean firstField = true;
> if(myField == null)
> {
>       if(firstField)
>       {
>               errors.add("javascriptErrors", new 
> ActionError("error.js.field.missing",
> fieldName));
>               firstField = false;
>       }
> 
> }
> 
> -- in message resources --
> 
> error.js.field.missing = <script>focusField = {0}</script>
> 
> -- in page --
> <script>
> var focusFiled = null;
> </script>
> 
> <body onload="if(focusField != null) document.all[focusField].focus;">
> 
> <html:errors property="javascriptErrors"/>
> 
> 
> 
> That's if you're making use of the message resources feature.
> 
> Just one possible suggestion
> 
> Steve
> 
> 
> -----Original Message-----
> From: Vance Heredia [mailto:[EMAIL PROTECTED]
> Sent: Monday, 11 August 2003 1:04 PM
> To: '[EMAIL PROTECTED]'
> Subject: How to return to form element
> 
> 
> 
> I use the Action Errors to validate a form.
> 
> If I do find errors does anyone know how to set the focus to 
> the first eroneous field present on the form when it returns to it ???
> 
> Vance
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Vance Heredia
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> ______________________________________________________________________
> This email, including attachments, is intended only for the 
> addressee and may be confidential, privileged and subject to 
> copyright.  If you have received this email in error, please 
> advise the sender and delete it.  If you are not the intended 
> recipient of this email, you must not use, copy or disclose 
> its content to anyone.  You must not copy or communicate to 
> others content that is confidential or subject to copyright, 
> unless you have the consent of the content owner.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

______________________________________________________________________
This email, including attachments, is intended only for the addressee
and may be confidential, privileged and subject to copyright.  If you
have received this email in error, please advise the sender and delete
it.  If you are not the intended recipient of this email, you must not
use, copy or disclose its content to anyone.  You must not copy or 
communicate to others content that is confidential or subject to 
copyright, unless you have the consent of the content owner.

Reply via email to