Where is the full client filename during FileUpload?
Hi all, I'm using a FIleUpload form component in order to save the full client filename (path + filename, i.e. /home/jdoe/myfiles/MyUploadableDocument.pdf), but for what I can see, I can retrieve only the filename using FileItem.getName(). I've tried to deeply debug wicket code to find the full path, but I only find client filename, server temp name, content-type, size. Someone on this forum states that browsers often send only the filename, not the full path (security reason??), but how can servers bind the source file without the full name? It must be somewhere, maybe in the servlet request... Besides, there is a smarter way to retrieve the full name (the one that appears in the input component!) without perform the upload? My use case oblige me to use FileUpload form component because the user use browser's popup search dialog. Thanks to all, BYE!
Form FileUploadField maxSize does not work
I'm working with a file upload, using http://www.wicket-library.com/wicket-examples/upload/single as example. I've created an UploadPanel very similar to UploadPage.java of the example (with the FileUploadForm form). Well I've maxsize set to 100K and this check work if I add my uploadpanel to the WebPage. But If I add the upload panel to a form, the check does not work anymore. The difference is that without outer form, the submit button of the upload panel belong to FileUploadForm (with maxSize set). With the outer form, the resulting submitting form correspond to the outer form. I don't understand this as I'm still clicking the same submit button of FileUploadForm. In this way, the maxsize is the one set in the outer form (which I don't want to set! I want to have my UploadPanel component with maxsize passed as parameter).
Form skips validation for disabled/not visible components
Hi all! I've a situation where I want the form to validate some hidden or disabled field. An example is a text field where the user is not allowed to write directly but only insert some items from some source, a lookup button (this is much more flexible than a drop down box!). I set this component disabled with .setEnabled(false). Now when the form is validated, the validation for my textfield is skipped (see Form class in wicket 1.4 rc4): public static abstract class ValidationVisitor implements FormComponent.IVisitor { public Object formComponent(IFormVisitorParticipant component) { if (component instanceof FormComponent) { FormComponent? formComponent = (FormComponent?)component; Form? form = formComponent.getForm(); if (!form.isVisibleInHierarchy() || !form.isEnabledInHierarchy()) { // do not validate formComponent or any of formComponent's children return Component.IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; } /** HERE WE SKIP!!! */ if (formComponent.isVisibleInHierarchy() formComponent.isValid() formComponent.isEnabledInHierarchy()) { validate(formComponent); } } if (component.processChildren()) { return Component.IVisitor.CONTINUE_TRAVERSAL; } else { return Component.IVisitor.CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER; } } Now I can override this, as Form.validateComponents() if final. I could only override Form.onSubmit() and doing an ad-hoc validation (not very good). Some hint? Thanks folk