My form looks like this:
Form<FilterCreatorFault> faultSearchForm = new 
Form<FilterCreatorFault>("faultSucheForm", new 
CompoundPropertyModel<FilterCreatorFault>(new FilterCreatorFault()));

I implement this Validator:
public class EmptyFormValidator  implements IFormValidator{

    private FormComponent formModel;
    private CSSFeedbackPanel feedback;

    public EmptyFormValidator (FormComponent formModel, CSSFeedbackPanel 
feedback){
        this.formModel = formModel;
        this.feedback = feedback;
    }

    @Override
    public FormComponent<?>[] getDependentFormComponents() {
        return new FormComponent<?>[]{formModel};
    }

    @Override
    public void validate(Form<?> components) {
        FilterCreatorFault fcf = (FilterCreatorFault) 
formModel.getConvertedInput();

        if(fcf == null){
            feedback.error("Empty");
        }
    }
}

The CompoundPropertyModel hast he type FilterCreatorFault. This isn't a 
FormComponent. So this isn't working. How can I validate with the 
CompoundPropertyModel?


Mit freundlichen Grüßen
Christoph Manig
Systems Engineer

T-Systems International GmbH
Systems Integration - SC Travel, Transport & Logistics
Hoyerswerdaer Str. 18
01099 Dresden 
tel.:   +49 (0) 351 / 8152 - 188
fax:    +49 (0) 351 / 8152 – 209
email:  [email protected]

-----Ursprüngliche Nachricht-----
Von: Martin Grigorov [mailto:[email protected]] 
Gesendet: Donnerstag, 16. Mai 2013 10:55
An: [email protected]
Betreff: Re: Empty Form Validation

Hi,

See IFormValidator


On Thu, May 16, 2013 at 11:51 AM, <[email protected]> wrote:

> Hello,
>
> I have a form which I want to validate. If this form is empty there 
> should be shown a message in the feedbackpanel. How can I do this? Is 
> there a way to validate an empty form with its compoundpropertymodel?
>
> Thank you for your help.
>
>
> Mit freundlichen Grüßen
> Christoph Manig
> Systems Engineer
>
> T-Systems International GmbH
> Systems Integration - SC Travel, Transport & Logistics Hoyerswerdaer 
> Str. 18
> 01099 Dresden
> tel.:   +49 (0) 351 / 8152 - 188
> fax:    +49 (0) 351 / 8152 - 209
> email:  [email protected]
>
>
>
>


--
Martin Grigorov
Wicket Training & Consulting
http://jWeekend.com <http://jweekend.com/>

Reply via email to