You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Sebastiaan van Erk <se...@sebster.com> on 2006/01/31 15:30:51 UTC

Focus of form fields

Hi all,

I have two small questions regarding the focus of fields in forms.

1) I have a password change page in which you must enter your old 
password, your new password, and must verify your new password. Now 
assume the user types his/her old password correctly but there is a 
password mismatch with the new password. I use the form delegate to set 
a consistency error between these two fields. The problem now is as 
follows: I clear *ALL* 3 fields (since they are password fields), and 
would like the focus to *ALWAYS* go to the first field even if it had no 
errors. Is this possible using the delegate or the form/field components 
somehow? I tried forcing focus on the first field using 
delegate.registerForFocus on the field with 
ValidatorConstants.ERROR_FIELD (which is already a bit of a hack in my 
opinion), but this did not work anyway.

2) On the login page the email address field (used to log in) is almost 
always prefilled with the value of a cookie. In this case I want to set 
the focus on the password field (if the cookie exists). I set the page 
property 'email' in pageBeginRender. Is it also possible to set the 
focus of the correct form component there?

In both cases I'm afraid to use a Script component because 1) it may 
interfere with the validation delegate, and 2) the scripts are already 
loaded by the Form component (in fact the form defaults to focusing the 
email field).

Thanks in advance for any help!

Greetings,
Sebastiaan


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