Prompt error message

Upload core product.
jecsp
Posts: 12
Joined: Mon Feb 23, 2009 7:54 am

Prompt error message

Post 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!

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Prompt error message

Post by support »

Try to add the following parameter:
<PARAM NAME="shorterrorjs" VALUE="false">

jecsp
Posts: 12
Joined: Mon Feb 23, 2009 7:54 am

Re: Prompt error message

Post 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!

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Prompt error message

Post 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);
}

Indu
Posts: 19
Joined: Tue Mar 10, 2009 6:09 pm

Re: Prompt error message

Post 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 ..

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Prompt error message

Post 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).

Indu
Posts: 19
Joined: Tue Mar 10, 2009 6:09 pm

Re: Prompt error message

Post by Indu »

It is still not working for me..Do I have to modify the .properties file??

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Prompt error message

Post by support »

Yes, see file enclosed below
JFileUpload-FTP-JSAPI-2.4Beta2.zip
(343.42 KiB) Downloaded 806 times
and a screesshot of my test:
jserror.jpg
(80.99 KiB) Downloaded 225 times

Indu
Posts: 19
Joined: Tue Mar 10, 2009 6:09 pm

Re: Prompt error message

Post 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 + '">');
Attachments
error.j.JPG
(38.77 KiB) Downloaded 209 times

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Prompt error message

Post 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 ?

Post Reply