Page 1 of 2

Prompt error message

Posted: Mon Mar 02, 2009 8:51 am
by jecsp
Hi,

Need your advice on how to prompt the error message, the error message now is shown on the progress bar (refer the attached image)
jfileupload.gif
(6.88 KiB) Downloaded 225 times
, I need it to prompt as alert. I'd tried to add the alert on

Code: Select all

function JSTransferFailed(errormsg)
{
   //alert(errormsg);
}
But it always prompt me the message "server error". I want the message like the one shown on the progress bar. Please advice.

Thank you!

Re: Prompt error message

Posted: Mon Mar 02, 2009 5:53 pm
by support
Try to add the following parameter:
<PARAM NAME="shorterrorjs" VALUE="false">

Re: Prompt error message

Posted: Tue Mar 03, 2009 1:55 am
by jecsp
Hi,

Can you explain more detail? just add the line <PARAM NAME="shorterrorjs" VALUE="false"> to the js file will do?

I added the line and changed the value to true but no different, the alert still no pop up. Please advice.

Thank you!

Re: Prompt error message

Posted: Tue Mar 03, 2009 7:15 am
by support
You need to add this parameter to the applet. As other parameters you need to setup it twice for cross-browser support.
<PARAM NAME="shorterrorjs" VALUE="false">

Then your JavaScript should display the full alert (server error - your custom message here):

Code: Select all

function JSTransferFailed(errormsg)
{
   alert(errormsg);
}

Re: Prompt error message

Posted: Mon Apr 06, 2009 2:28 pm
by Indu
I am trying to do the same..I added the line document.writeln('<PARAM NAME="shorterrorjs" VALUE="false">');
I still get the error in the progressbar not as an alert..Do I have to keep the javascript in a file named shorterrorjs?? Right now I put in the same page where the applet is ..

Re: Prompt error message

Posted: Mon Apr 06, 2009 7:46 pm
by support
No, it's in the same JavaScript:

Code: Select all

...
document.write('shorterrorjs="false" ');
...
document.writeln('<PARAM NAME="shorterrorjs" VALUE="false">');
...
It allows displaying the full error message as in the progress bar. Did you close all browser windows before testing ? (to make sure the applet is completely unloaded).

Re: Prompt error message

Posted: Mon Apr 06, 2009 8:30 pm
by Indu
It is still not working for me..Do I have to modify the .properties file??

Re: Prompt error message

Posted: Tue Apr 07, 2009 5:13 pm
by support
Yes, see file enclosed below
JFileUpload-FTP-JSAPI-2.4Beta2.zip
(343.42 KiB) Downloaded 1266 times
and a screesshot of my test:
jserror.jpg
(80.99 KiB) Downloaded 225 times

Re: Prompt error message

Posted: Tue Apr 07, 2009 6:13 pm
by Indu
Thankyou so much for your reply..Here is the way I calling the applet..When I drag and drop a file extention which is not allowed by the applet, the error still displays in the progress bar rather than as a javascript error


document.writeln(' classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="590" HEIGHT="300" NAME="fileupload" codebase="http://java.sun.com/update/1.4.2/jinsta ... on=1,4,0,0">');
document.writeln('<PARAM NAME=CODE VALUE="jfileupload.upload.client.MApplet.class">');
document.writeln('<PARAM NAME=CODEBASE VALUE="./">');
document.writeln('<PARAM NAME=ARCHIVE VALUE="lib/jfileupload.jar,lib/httpimpl.jar,lib/chttpclient.jar,lib/clogging.jar,lib/batchui.jar">');
document.writeln('<PARAM NAME=NAME VALUE="fileupload">');
document.writeln('<PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">');
document.writeln('<PARAM NAME="scriptable" VALUE="true">');
document.writeln('<PARAM NAME="url" VALUE="' + PropUrl2 + '">');
document.writeln('<PARAM NAME="paramfile" VALUE="uploadfile">');
document.writeln('<PARAM NAME="param1" VALUE="todo">');
document.writeln('<PARAM NAME="value1" VALUE="upload">');
//document.writeln('<PARAM NAME="param2" VALUE="errorheader">');
//document.writeln('<PARAM NAME="value2" VALUE="custommessage">');
//document.writeln('<PARAM NAME="param3" VALUE="relativefilename">');
document.writeln('<PARAM NAME="value3" VALUE="true">');
document.writeln('<PARAM NAME="folderdepth" VALUE="-1">');
document.writeln('<PARAM NAME="param4" VALUE="account">');
document.writeln('<PARAM NAME="value4" VALUE="'+folderId+'">');
document.writeln('<PARAM NAME="transferui" VALUE="jfileupload.transfer.client.edesign.BatchTransferUI">');
//document.writeln('<PARAM NAME="transferuiresources" VALUE="i18n_pane">');
//document.writeln('<PARAM NAME="resources" VALUE="i18n_bar">');
document.writeln('<PARAM NAME="mode" VALUE="http">');
document.writeln('<PARAM NAME="post" VALUE="' + forwardUrl + '">');
//document.writeln('<PARAM NAME="overwrite" VALUE="false">');
//document.writeln('<PARAM NAME="resume" VALUE="true">');
//document.writeln('<PARAM NAME="chunkmode" VALUE="onfly">');
//document.writeln('<PARAM NAME="chunksize" VALUE="2048000">');
document.writeln('<PARAM NAME="shorterrorjs" VALUE="false">');
document.writeln('<PARAM NAME="param5" VALUE="httpmethod">');
document.writeln('<PARAM NAME="value5" VALUE="put">');
document.writeln('<PARAM NAME="whitelist" VALUE="' + whitelist + '">');

Re: Prompt error message

Posted: Tue Apr 07, 2009 9:58 pm
by support
oh, yes, because the JavaScript reports transfer error only. the callback is JSTransferFailed(...).
I don't think we have a callback for selection error. We have one for file amount in the queue. Could it help ?