upload file content to textarea

2009-09-16 Thread Sam Zilverberg
In one of my wizard's steps I have a upload form and a textarea. The textarea is used to enter serial numbers(seperated by newline) and is connected to a object property of type SetString using a propertymodel. I've written a custom converter to turn the entered input to a SetString and from a

Re: upload file content to textarea

2009-09-16 Thread Martin Makundi
You could ajax update the textarea after upload, with the content that you want? If you do not want to set the model object then you will have to fake raw input (reflection). ** Martin 2009/9/16 Sam Zilverberg samzilverb...@gmail.com: In one of my wizard's steps I have a upload form and a

Re: upload file content to textarea

2009-09-16 Thread Sam Zilverberg
sounds good, but how do I do this? :) On Wed, Sep 16, 2009 at 9:45 PM, Martin Makundi martin.maku...@koodaripalvelut.com wrote: You could ajax update the textarea after upload, with the content that you want? If you do not want to set the model object then you will have to fake raw input

Re: upload file content to textarea

2009-09-16 Thread Martin Makundi
1. You know how to upload file? http://www.wicket-library.com/wicket-examples/upload/single - or ajax upload http://blog.demay-fr.net/index.php/2007/12/07/93-simulate-ajax-file-upload-with-wicket 2. Just put the file contents into textarea with jafa reflection. 3. AJax update the textarea:

Re: upload file content to textarea

2009-09-16 Thread Sam Zilverberg
thanks a lot for the help and the links! I checked them all out, the second one (upload panel) was too complicated for me atm. Maybe I'l come back to it when I'l have more experience with wicket. I liked the timed ajax behaviour example, but couldn't figure out exactly how it works so i could

Re: upload file content to textarea

2009-09-16 Thread Martin Makundi
Hi! I currently solved this problem by filtering the input from the uploaded file and creating a correct object model (SetString)  out of it, then setting the modelObject of the textarea to be this filtered one. Good, so you got the upload part working. By reflection I mean that instead of

Re: upload file content to textarea

2009-09-16 Thread Martin Makundi
Ah.. forgot that crucial part, the reflection: public static T extends FormComponent? void fakeRawInput(T formComponent, String value) { try { rawInputField.set(formComponent, value); } catch (Exception e) { Utils.errorLog(MarkupUtils.class, Fatal Error: Form field access

Re: upload file content to textarea

2009-09-16 Thread Sam Zilverberg
I'd rather use some other method than mine, because with mine the validation of input is done twice when uploading. first on the uploaded file, and then another time on the textarea when pressing the wizard's next button. I tried replacing my fixup with this one but got a big fat

Re: upload file content to textarea

2009-09-16 Thread Martin Makundi
No.. the field name is rawInput: rawInputField = FormComponent.class.getDeclaredField(rawInput); ** Martin 2009/9/17 Sam Zilverberg samzilverb...@gmail.com: I'd rather use some other method than mine, because with mine the validation of input is done twice when uploading. first on the