Ah yes, but it does not actually validate. Very funny results. Is this
ok or am I doing something wrong?
Principally what I have is:
parent form
nested form - one per row
rowName
parentForm.add(duplicateRowValidator);
None of the rows is allowed to have duplicate names so what I do is:
duplicateRowValidator: foreach nestedRow if (!set.add(getLatestValue))
error(duplicate row);
Now I know I can get the "latest" value of the nested row using my own
helper method:
@SuppressWarnings("unchecked")
public static <T> T getConvertedValue(FormComponent<T> formComponent) {
return (T)
formComponent.getConverter(formComponent.getType()).convertToObject(formComponent.getValue(),
Session.get().getLocale());
}
BUT, is this necessary? Is there a framework method to do this for me?
**
Martin
2009/9/29 Pedro Santos <[email protected]>:
> So sometimes validators will process formcomponents whose input has not been
> converted??
>
> Sometimes the form component validation method will test himself and
> children for validations errors reported, before and after the user input
> get converted.
>
> On Tue, Sep 29, 2009 at 2:04 AM, Martin Makundi <
> [email protected]> wrote:
>
>> Hi!
>>
>> formComponent.getValue() allways gives you the latest user input OR
>> the model value. This is useful for validation purposes, but is there
>> a bluilt-in "get converted value" method?
>>
>> There is "getConvertedInput" -method, but that will only give you the
>> user-submitted value if it has already been converted. The validation
>> sequence is a bit funny:
>>
>> public void validate()
>> {
>> validateRequired();
>> if (isValid()) <----------- this validator will not receive
>> converted input
>> {
>> convertInput();
>> if (isValid())
>>
>> So sometimes validators will process formcomponents whose input has
>> not been converted?? How to deal with that properly?
>>
>> **
>> Martin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
> --
> Pedro Henrique Oliveira dos Santos
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]