You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raghuveer <ra...@infotechsw.com> on 2006/03/24 09:59:53 UTC

focus in html object

 In my log screen i have 2 text boxes to  input user login user id and
password.
Initiall when page loads i am focusing on username by focus attribute in
form tag.
If there is an error in password , i  display Struts Action Error as
"password is required."

What i need to do to focus the cursor on "password" textbox when there is
error in password.

I.e Does struts1.2.8 provides any facility for focusing respective html
object (if there is any error related to the property )?

-------------------------------------------
<html:form  action="/Login.do?method=loginCheck"  focus="username" >
 <html:text property="username" size="15" maxlength="20"
styleClass="inputBox" /><html:errors  property="username"/>
<html:password property="password" size="15" maxlength="20"
redisplay="false"  styleClass="inputBox"/><html:errors
property="password"/>

---------------------------------





---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: focus in html object with style change

Posted by Laurie Harper <la...@holoweb.net>.
See errorStyle and/or errorStyleClass:

http://struts.apache.org/struts-doc-1.2.x/userGuide/struts-html.html#password

L.

Raghuveer wrote:
> Is it possiable atleast to make by password field with color change when
> ever
> there is error message for
> 
> <html:errors property="password"/>
> 
> Example:
> background color red for password field.
> <html:password property="password" size="15" maxlength="20"
> redisplay="false"  styleClass="inputBox"/>
> 
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Rahul Akolkar [mailto:rahul.akolkar@gmail.com]
> Sent: Friday, March 24, 2006 6:50 PM
> To: Struts Users Mailing List; raghuveerv@infotechsw.com
> Subject: Re: focus in html object
> 
> 
> On 3/24/06, Raghuveer <ra...@infotechsw.com> wrote:
>>  In my log screen i have 2 text boxes to  input user login user id and
>> password.
>> Initiall when page loads i am focusing on username by focus attribute in
>> form tag.
>> If there is an error in password , i  display Struts Action Error as
>> "password is required."
>>
>> What i need to do to focus the cursor on "password" textbox when there is
>> error in password.
>>
>> I.e Does struts1.2.8 provides any facility for focusing respective html
>> object (if there is any error related to the property )?
>>
>> -------------------------------------------
>> <html:form  action="/Login.do?method=loginCheck"  focus="username" >
> <snip/>
> 
> The functionality is provided, since focus is rtexprvalue true, so you
> can render an expression of choice as its value (for instance, one
> which checks for password errors being present and returns either
> "username" or "password" accordingly).
> 
> -Rahul
> 
> 
>>  <html:text property="username" size="15" maxlength="20"
>> styleClass="inputBox" /><html:errors  property="username"/>
>> <html:password property="password" size="15" maxlength="20"
>> redisplay="false"  styleClass="inputBox"/><html:errors
>> property="password"/>
>>
>> ---------------------------------
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: focus in html object with style change

Posted by Raghuveer <ra...@infotechsw.com>.
Is it possiable atleast to make by password field with color change when
ever
there is error message for

<html:errors property="password"/>

Example:
background color red for password field.
<html:password property="password" size="15" maxlength="20"
redisplay="false"  styleClass="inputBox"/>







-----Original Message-----
From: Rahul Akolkar [mailto:rahul.akolkar@gmail.com]
Sent: Friday, March 24, 2006 6:50 PM
To: Struts Users Mailing List; raghuveerv@infotechsw.com
Subject: Re: focus in html object


On 3/24/06, Raghuveer <ra...@infotechsw.com> wrote:
>
>  In my log screen i have 2 text boxes to  input user login user id and
> password.
> Initiall when page loads i am focusing on username by focus attribute in
> form tag.
> If there is an error in password , i  display Struts Action Error as
> "password is required."
>
> What i need to do to focus the cursor on "password" textbox when there is
> error in password.
>
> I.e Does struts1.2.8 provides any facility for focusing respective html
> object (if there is any error related to the property )?
>
> -------------------------------------------
> <html:form  action="/Login.do?method=loginCheck"  focus="username" >
<snip/>

The functionality is provided, since focus is rtexprvalue true, so you
can render an expression of choice as its value (for instance, one
which checks for password errors being present and returns either
"username" or "password" accordingly).

-Rahul


>  <html:text property="username" size="15" maxlength="20"
> styleClass="inputBox" /><html:errors  property="username"/>
> <html:password property="password" size="15" maxlength="20"
> redisplay="false"  styleClass="inputBox"/><html:errors
> property="password"/>
>
> ---------------------------------
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: focus in html object

Posted by Rahul Akolkar <ra...@gmail.com>.
On 3/24/06, Raghuveer <ra...@infotechsw.com> wrote:
>
>  In my log screen i have 2 text boxes to  input user login user id and
> password.
> Initiall when page loads i am focusing on username by focus attribute in
> form tag.
> If there is an error in password , i  display Struts Action Error as
> "password is required."
>
> What i need to do to focus the cursor on "password" textbox when there is
> error in password.
>
> I.e Does struts1.2.8 provides any facility for focusing respective html
> object (if there is any error related to the property )?
>
> -------------------------------------------
> <html:form  action="/Login.do?method=loginCheck"  focus="username" >
<snip/>

The functionality is provided, since focus is rtexprvalue true, so you
can render an expression of choice as its value (for instance, one
which checks for password errors being present and returns either
"username" or "password" accordingly).

-Rahul


>  <html:text property="username" size="15" maxlength="20"
> styleClass="inputBox" /><html:errors  property="username"/>
> <html:password property="password" size="15" maxlength="20"
> redisplay="false"  styleClass="inputBox"/><html:errors
> property="password"/>
>
> ---------------------------------
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org