<<On 11/19/05, Andrew Berman <[EMAIL PROTECTED]> wrote:
I'm sure the model is not changed, it's the expected behaviour, because the Component is marked invadid() because the form is invalid (for any sensible reason).
But contrary to other components, the value that is represented to the user (can see it with Show source page function of browser) comes from the model, not from the invalidInput field ...
Here is the code from PasswordTextField:
protected final void onComponentTag(final ComponentTag tag)
{
checkComponentTag(tag, "input");
checkComponentTagAttribute(tag, "type", "password");
super.onComponentTag(tag);
tag.put("value", getResetPassword() ? "" : getModelObjectAsString());
}
direct call to getModelObjectAsString()
and here from TextField:
protected void onComponentTag(final ComponentTag tag)
{
// Must be attached to an input tag
checkComponentTag(tag, "input");
// If this is not a subclass (PasswordTextField)
if (getClass() == TextField.class)
{
// check for text type
checkComponentTagAttribute(tag, "type", "text");
}
// No validation errors
tag.put("value", getValue());
// Default handling for component tag
super.onComponentTag(tag);
}
You can see here the call to the getValue() method, which will return invalidInput or getModelObjectAsString() as needed.
You must not be doing something right if the password field is not changing. Are you sure the model is changing with the new value?
I'm sure the model is not changed, it's the expected behaviour, because the Component is marked invadid() because the form is invalid (for any sensible reason).
But contrary to other components, the value that is represented to the user (can see it with Show source page function of browser) comes from the model, not from the invalidInput field ...
Here is the code from PasswordTextField:
protected final void onComponentTag(final ComponentTag tag)
{
checkComponentTag(tag, "input");
checkComponentTagAttribute(tag, "type", "password");
super.onComponentTag(tag);
tag.put("value", getResetPassword() ? "" : getModelObjectAsString());
}
direct call to getModelObjectAsString()
and here from TextField:
protected void onComponentTag(final ComponentTag tag)
{
// Must be attached to an input tag
checkComponentTag(tag, "input");
// If this is not a subclass (PasswordTextField)
if (getClass() == TextField.class)
{
// check for text type
checkComponentTagAttribute(tag, "type", "text");
}
// No validation errors
tag.put("value", getValue());
// Default handling for component tag
super.onComponentTag(tag);
}
You can see here the call to the getValue() method, which will return invalidInput or getModelObjectAsString() as needed.
--AndrewOn 11/18/05, Laurent PETIT < [EMAIL PROTECTED]> wrote:On 11/18/05, Eelco Hillenius <[EMAIL PROTECTED] > wrote:Yeah. It was a feature.
I don't see the value of that feature, could you explain ?
My point of view :
A user account page, with ability to modify name, address, and password.
All the values of the database are prefilled (including password, using setResetPassword(false) ).
The user modifies some fields, including password, but enters an invalid address and submits.
All the fields a re-rendered as the user had entered them, but the password field is the only that does not take into account the new value, but the original -still not modified- from the model.
I don't see the need ?