Hi Everyone
I'm trying to upload a file using AjaxFormSubmitBehavior .
When i submit the form , the defined onSubmit() method is not being called. Can
anyone tell me why this is happening ?
Code given below:
Java code is :
Form f = new Form("f");
f.setOutputMarkupId(true);
f.setMultiPart(true);
f.setMaxSize(Bytes.MAX);
f.add(upload = new FileUploadField("fileInput"));
f.add(new Button("ok"));
f.add(new AjaxFormSubmitBehavior("onsubmit") {
protected void onSubmit(AjaxRequestTarget target) {
log.debug("inside onSubmit");
FileUpload fileUpload = upload.getFileUpload();
log.debug(fileUpload.getBytes());
}
@Override
protected void onError(AjaxRequestTarget arg0) {
// TODO Auto-generated method stub
}
});
add(f);
}
Form in the html file is :
<form id="uploadForm" wicket:id="f">
<fieldset>
<div>
<input type="file" wicket:id="fileInput"/>
<input wicket:id="ok" type="submit" value="Upload!"/>
</div>
</fieldset>
</form>
Thanks
Haritha
____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now.
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ