How to override SignInPanel's error messages.

2011-08-26 Thread Florian B.
I'm using the SignInPanel on my web application and it works quite well. The
only thing I want to change are the error message which got rendered to the
feedback panel when no login or password is entered. 

The error message is not really nice at is contains the internal name of the
text field that is empty which the user is not aware of. So some how
changing it from Field 'password' is required. to Please enter a
password. would be great. 

Changing the error message for a log in failure was quite easy. I simply
added a new entry 'signInFailed' in the properties file of my log in page.

Is there a way to do this also for the missing values? Or do I have to
implement a custom SignInPanel?






--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-override-SignInPanel-s-error-messages-tp3770610p3770610.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to override SignInPanel's error messages.

2011-08-26 Thread Florian B.
I finally solved my problem perhaps it's not the best way but it works for
me. 

After digging in the sources of the SignInPanel I figured out the following.
setRequired() is always called in the constructor of a PasswortTextField.
setRequired() is a method of the FormComponent class which has also a method
reportRequiredError() that writes the error message.  In the implementation
of the method you can see that the resource key for the required error
message is Required. So I simply override this key in the properties file
of my login page and it worked perfectly. 

private void reportRequiredError()
{
error(new ValidationError().addMessageKey(Required));
}

I know it is not the best solution as this will override the required error
message of any other FormComponent object on the login page on which
setRequired(true) was called. But as the SignInForm is the only Form on my
login page this is ok for me. 

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-override-SignInPanel-s-error-messages-tp3770610p3770703.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to override SignInPanel's error messages.

2011-08-26 Thread Martin Grigorov
enable DEBUG logging of Localizer class and you'll see what resource
keys are attempted
this way you'll see that you can use myFormComponentId.Required=
and it will be used just for the component with id
myFormComponentId, all other will still use 'Required'.

On Fri, Aug 26, 2011 at 3:18 PM, Florian B. florian.bernst...@gmail.com wrote:
 I finally solved my problem perhaps it's not the best way but it works for
 me.

 After digging in the sources of the SignInPanel I figured out the following.
 setRequired() is always called in the constructor of a PasswortTextField.
 setRequired() is a method of the FormComponent class which has also a method
 reportRequiredError() that writes the error message.  In the implementation
 of the method you can see that the resource key for the required error
 message is Required. So I simply override this key in the properties file
 of my login page and it worked perfectly.

 private void reportRequiredError()
 {
    error(new ValidationError().addMessageKey(Required));
 }

 I know it is not the best solution as this will override the required error
 message of any other FormComponent object on the login page on which
 setRequired(true) was called. But as the SignInForm is the only Form on my
 login page this is ok for me.

 --
 View this message in context: 
 http://apache-wicket.1842946.n4.nabble.com/How-to-override-SignInPanel-s-error-messages-tp3770610p3770703.html
 Sent from the Users forum mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org





-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: How to override SignInPanel's error messages.

2011-08-26 Thread Florian B.
A great, that's even better!

Thanks!

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/How-to-override-SignInPanel-s-error-messages-tp3770610p3770720.html
Sent from the Users forum mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org