Hi All,

I am using GWTEXt widgets and when trying to upload the files in
Hosted mode then formListener is not working....


private void testFileUpload() {

Panel innerHorizontalPanel = new Panel();
innerHorizontalPanel.setLayout(new HorizontalLayout(5));

final TextField fileUploadTextField = new TextField();
fileUploadTextField.setWidth(_ShrisureConstants.LABEL_STRING_WIDTH);
fileUploadTextField.setInputType("file");
fileUploadTextField.setName("uploadFormElement");
fileUploadTextField.setHeight("21");

Button uploadSubmitButton = new Button("Upload File");

final FormPanel uploadFormExt = new FormPanel();
uploadFormExt.setLabelWidth(_ShrisureConstants.LABEL_WIDTH);
uploadFormExt.setUrl("MyFileUploader");
uploadFormExt.setLabelAlign(Position.LEFT);
uploadFormExt.setFileUpload(true);
uploadFormExt.setMethod(Connection.POST);
uploadFormExt.add(fileUploadTextField);

uploadSubmitButton.addListener(new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
String completeFileClientPath = fileUploadTextField.getValueAsString
();
if (completeFileClientPath.length() > 0) {
uploadFormExt.getForm().submit();
}
}
});

uploadFormExt.getForm().addListener(new FormListenerAdapter() {
public void onActionComplete(Form form, int httpStatus, String
responseText) {
System.out.println("httpStatus [" + httpStatus + responseText);

}

public void onActionFailed(Form form, int httpStatus, String
responseText) {
new RuntimeException("onActionFailed==").printStackTrace();
MessageBox.alert("File Upload fails because server is busy");
}
});
innerHorizontalPanel.add(uploadFormExt);
innerHorizontalPanel.add(uploadSubmitButton);
RootPanel.get().add(innerHorizontalPanel);
}


Thanks and regards,


Sunil.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"GWT-Ext Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/gwt-ext?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to