Re: Where is the full client filename during FileUpload?
Yes you are right, file full path file is never send. In fact exploring DOM I've found no property to fetch it. Thank you! So I use a simple TextField. @kinabalu getClinetFilename() does not return the full path, while temp file path is the path on the server where the file is phisically copied, while I was lookin for the original path of the file on the clinet filesystem. Thank you all! ananthakumaran wrote: > > Technically you cann't get the full path of the file using javascript. you > are allowed the access the relative name of the file > only.it is also read only (security reason). otherwise you could upload a > file without the knowledge of the user. > > see http://www.cs.tut.fi/~jkorpela/forms/file.html for reference > > 2010/2/3 Nicola Tucci > >> 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! >> > > > > -- > > Anantha Kumaran > > -- View this message in context: http://old.nabble.com/Where-is-the-full-client-filename-during-FileUpload--tp27439835p27456734.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form FileUploadField maxSize does not work
Yes the issue is that, the form being submitted is the outer (which has no maxsize set, so default is used). When I submit upload0, Form.handleMultiPart() is called on the outer form (form0). When I submit upload1, Form.handleMultiPart() is called on simpleUpload. I'm missing something or doing something wrong? igor.vaynberg wrote: > > so is the problem that the form being submitted is the outer form and > it doesnt support the inner form's maxsize? > > -igor > -- View this message in context: http://www.nabble.com/Form-FileUploadField-maxSize-does-not-work-tp25293039p25326577.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form FileUploadField maxSize does not work
Yes igor, below there is the code, even if is not very short. The issue is that when I click on upload1 button the submitting form is form0 instead of simpleUpload. Maybe I've bad-coded some part. /** the upload panel, very similar to the wicket example **/ public class UploadFilePanel extends Panel { /** * Form for uploads. */ private class FileUploadForm extends Form implements IFormVisitorParticipant{ private FileUploadField fileUploadField; public FileUploadForm(String name, IModel model, Bytes maxSize){ super(name); // set this form to multipart mode setMultiPart(true); // Add one file input field add(fileUploadField = new FileUploadField("fileInput", model)); setMaxSize(maxSize); } @Override protected void onSubmit(){ final FileUpload upload = fileUploadField.getFileUpload(); if (upload != null){ // Create a new file File newFile = new File(getUploadFolder(), upload.getClientFileName()); try{ // Save to new file newFile.createNewFile(); upload.writeTo(newFile); FileUploadForm.this.info("saved file: " + upload.getClientFileName()); } catch (Exception e){} } } } public UploadFilePanel(String id, Bytes maxSize) { super(id); // Add simple upload form, which is hooked up to its feedback panel by // virtue of that panel being nested in the form. if (maxSize==null) maxSize = Bytes.kilobytes(100); final FileUploadForm simpleUploadForm = new FileUploadForm("simpleUpload", new Model(null), maxSize); add(simpleUploadForm); final FeedbackPanel uploadFeedback = new FeedbackPanel("uploadFeedback", new ContainerFeedbackMessageFilter(this)); add(uploadFeedback); } } /** the panel html **/ /** the test page **/ public class TestPage extends WebPage { Form form0 = new Form("form0"); UploadFilePanel upload0 = new UploadFilePanel("upload0", Bytes.kilobytes(100)); form0.add(upload0); /*** this upload DOES NOT check max size ***/ add(form0); UploadFilePanel upload1 = new UploadFilePanel("upload1", Bytes.kilobytes(100)); add(upload1); /*** this upload DOES check max size ***/ } /** test page html **/ igor.vaynberg wrote: > > perhaps if you showed your code it would be more clear. > > -igor > -- View this message in context: http://www.nabble.com/Form-FileUploadField-maxSize-does-not-work-tp25293039p25297271.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Nested forms : don't process inner form when outer form is submitted
John Krasnay wrote: > > The isEnabled method only controls form processing on the server. If you > can't even type characters in your text field you have something else > going on at the browser level. > Well usually in a disabled box you cannot type, no matter what browser you are using. Anyway I think we can let the fields enabled but override the isRequired(): if the submitting is the rootform just return false. In this way component is correctly displayed but validated when submitting the inner form (the one to which it belongs). -- View this message in context: http://www.nabble.com/Nested-forms-%3A-don%27t-process-inner-form-when-outer-form-is-submitted-tp21910941p24847306.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Nested forms : don't process inner form when outer form is submitted
In the example, the inner form is enabled only when the submitter button is that of itself (i.e. I'm submitting the inner form). In all other cases the form is always disabled: I've tried the example and in factthe form is totally disabled, I can't fill my textfield and I can't even submit the form. Something is wrong with the example? John Krasnay wrote: > > Have a look at the bottom of this page: > > http://cwiki.apache.org/WICKET/conditional-validation.html > > The example shown disables the whole inner form when the outer form is > submitted, meaning the inner form won't even be submitted. If you want > the inner form to be submitted but just not required, remove the > isEnabled override and implement isRequired on your text fields with > similar code. > > jk > > On Tue, Feb 10, 2009 at 12:33:00AM -0800, Marieke Vandamme wrote: >> >> Thanks for the suggestions, but I'm still not sure how to implement it. >> My innerform implements IFormVisitorParticipant. I override >> processChildren(), but how do I know which form is getting submitted??? >> Because when innerform is submitted, i want to return true, otherwise >> false. >> Thanks for any help!! Marieke. >> >> >> igor.vaynberg wrote: >> > >> > try letting your inner form implement IFormVisitorParticipant. >> > >> > another way is to override isrequired() and check for the submitting >> > component. >> > >> > -igor >> > >> > On Mon, Feb 9, 2009 at 3:17 AM, Marieke Vandamme wrote: >> >> >> >> Hello, >> >> >> >> I've been reading a lot about nested forms and what should happen with >> >> the >> >> inner forms when the outer form gets submitted. But I didn't found out >> >> how >> >> you can implement what i'm trying: >> >> >> >> I have inner form with some RequiredTextFields on it. These are >> required >> >> when the inner form is processed with an AjaxButton, but not when the >> >> outer >> >> form is submitted. >> >> >> >> How can I do this? Thanks for any help !!! Marieke. >> >> -- >> >> View this message in context: >> >> >> http://www.nabble.com/Nested-forms-%3A-don%27t-process-inner-form-when-outer-form-is-submitted-tp21910941p21910941.html >> >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> >> >> >> - >> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> >> >> >> > >> > - >> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> > For additional commands, e-mail: users-h...@wicket.apache.org >> > >> > >> > >> >> -- >> View this message in context: >> http://www.nabble.com/Nested-forms-%3A-don%27t-process-inner-form-when-outer-form-is-submitted-tp21910941p21929547.html >> Sent from the Wicket - User mailing list archive at Nabble.com. >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > > -- View this message in context: http://www.nabble.com/Nested-forms-%3A-don%27t-process-inner-form-when-outer-form-is-submitted-tp21910941p24841072.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form skips validation for disabled/not visible components
James Carman-3 wrote: > > And, if you want to display the currently-selected "thing", then try > using a label (with a little style to it perhaps). > > On Mon, Aug 3, 2009 at 11:23 AM, Igor Vaynberg > wrote: >> use HiddenField instead of a TextField, that way there is no need to >> disable it. >> >> then the textfield/lookup button can be client-side things that >> populate the hidden field. >> >> -igor > Yes HiddenField is nice stuff! I will use IFormValidator as I've to re-utilize it in several places. Thank you all! -- View this message in context: http://www.nabble.com/Form-skips-validation-for-disabled-not-visible-components-tp24790510p24809865.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form skips validation for disabled/not visible components
egolan74 wrote: > > 1. If you in control of the input of these disabled fields, why allowing > illegal arguments in the first place? > 2. If you can't control the entered values, try use FormValidator. With > this > class, you can create your own Validate logic with the desired fields. > 1. Good observation, but my goal is checking for required fields. 2. That's an idea: I can write my class imlpementing IFormValidator and then add this to the container form. For checking required fields somethign like this could work: public class RequiredFieldsValidator extends AbstractFormValidator { private List components; public RequiredFieldsValidator(List components) { this.components = components; } public void validate(Form form) { for(FormComponent c: components) { validateRequired(); } } } -- View this message in context: http://www.nabble.com/Form-skips-validation-for-disabled-not-visible-components-tp24790510p24792189.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org