PDA

View Full Version : FormPanel validation with child Panels



EagleEye666666
19 Jan 2009, 3:43 AM
Iam using a Formpanel with the basic fields and to this iam adding a custom component(inherits from ContentPanel/FormPanel no difference) .

My problem is that this fields are marked as not allowed to be blank (cuz this throw IOExcpetions on the serverside):

protected Widget getUploadField() {
final FileUploadField temp = new FileUploadField();
temp.setName("fileNr_"+(++fileNr));
temp.setAllowBlank(false);
return temp;
}

Everything works so far if the FormPanel submits it also send the added FileUploadFields... problem is here that the validation is not working. I even tried to add a listener:
adding this panel(here i tried inherits FormPanel) to my formPanel:

Button btn = new Button("Upload Files");
btn.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
FormPanel upload = (FormPanel)getItemByItemId("upload");
if (isValid() && upload.isValid()) {
submit();
}
return;
}
});

FileUploadPanel upload = new FileUploadPanel("Files to upload");
upload.setId("upload");
getButtonBar().add(btn);
add(upload);
layout();

all the time validation is true :( even the fields arent filled...

There is missing validation check of child components if they are formfields???

EDIT1:
I debugged the main FormPanel do not have the FileUploadFileds as childs... so valdition is ok, cuz there are no fields. But why the heck i have on the serverside than ALL fields in the request(including the FileUploadFields)?

EDIT2:
I have maybe some answer, when submit a formPanel, the full DOM is added to the response right? Otherwise i can't explain why the fileuploadfields are appearing on serverside... Iam right? can somebody help me?