PDA

View Full Version : FileUploadField's duplicate OnChange event in Firefox 4



cleonf
28 Mar 2011, 3:40 PM
Hello,

I am not sure whether this issue has been reported, but I beleive that there's a bug on FileUploadField's Event listener when running in Firefox.

The following code triggers the listener twice:

fileUpload.addListener(Events.OnChange, new Listener<FieldEvent>(){

@Override
public void handleEvent(FieldEvent be) {
if(fileDescription.getValue() != null && !fileDescription.getValue().isEmpty()){
submitFileUpload(fileUpload, fileDescription);
}
else{

MessageBox prompt = new MessageBox();
prompt.setTitle("Descrição de Ficheiro");
prompt.setMessage("Introduza descrição para o ficheiro '"+fileUpload.getValue()+"' (Deixe em branco se não pretender descrição): ");
prompt.setType(MessageBoxType.PROMPT);
prompt.setIcon(MessageBox.QUESTION);
prompt.setButtons(MessageBox.OK);
prompt.setModal(false);
prompt.addCallback(new Listener<MessageBoxEvent>(){

@Override
public void handleEvent(MessageBoxEvent be) {
fileDescription.setValue(be.getValue());
submitFileUpload(fileUpload, fileDescription);
}

});

prompt.show();
}
}
});

This has been working fine in IE and Firefox 3.6.15. I'm using GXT 2.2.3 with GWT 2.2.0.

Thanks