vendredi 27 novembre 2020

How to convert the CheckGroup<> to FormComponent for Validation

I have a dropdownchoice and checkbox . Have added code to throw error when none of these are selected by the user onsubmit .

CheckGroup billableGroup = new CheckGroup<>(id, new PropertyModel<Collection>(billableProjects, "projects")); billableGroup.add(new CheckGroupSelector("checkall"));

DropDownChoice billableProjectsList = new DropDownChoice<>( ......... new ChoiceRenderer("fullNameWithCustomer")); billableProjectsList.setLabel(new ResourceModel("printMonth.billable"));

form.add(new FormComponentValidator(billableProjectsList, billableGroup)); I am unable to add the checkgroup to the Validator since its not converting to FormCompnent.

public class FormComponentValidator extends AbstractFormValidator {.....}

Please let me know how to convert the checkgroup to FormCompenent and use it for validation.




Aucun commentaire:

Enregistrer un commentaire