JFileUpload, Forms and JSAPI

Upload core product.
Post Reply
cchristoph
Posts: 5
Joined: Tue Feb 24, 2009 6:13 am

JFileUpload, Forms and JSAPI

Post by cchristoph »

I've tried jsapi to intercept some events to pass arguments from a form to jfileupload.

The problem is that the JSTransfertTriggered doesn't do the trick. The argument I set in this function is not available for the current download but for the next.

Is there a solution to pass parameters from the form to the applet by this means ?
I would like to take the value from fields on the page containing the template.

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

Re: JFileUpload, Forms and JSAPI

Post by support »

Ok, you can pass extra parameter (i.e. your custom parameter) to the applet through:
<PARAM NAME="param6" VALUE="yourparam">
<PARAM NAME="value6" VALUE="yourvalue">

With the JSAPI, you can get any extra parameter at anytime through:
var v = document.fileupload.getExtraParameter(extraparam);

So what about using getExtraParameter inside the JSTransferTriggered(...) JavaScript callback ?
For instance:

Code: Select all

function JSTransferTriggered(files)
{
  var v = document.fileupload.getExtraParameter("yourparam");
}
Could it help ?

cchristoph
Posts: 5
Joined: Tue Feb 24, 2009 6:13 am

Re: JFileUpload, Forms and JSAPI

Post by cchristoph »

I don't need to get the value of the parameter I write in the applet, I don't thing getExtraParameter will do the trick.
When I create the page with the applet I don't know the values of the parameters, I thus need a form to ask them to the user and before just upload begins I need a way to send them to the applet.

If in JSTransfertTriggered I write an alert, it displays correctly but it doesn't wait I close the dialog before uploading the file.
If I use setExtraParameter, it is not taken into account for the current download but it will be used for subsequent one.

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

Re: JFileUpload, Forms and JSAPI

Post by support »

I see ... and can't you call setExtraParameter(name,value) before the end-user select files and upload ?

cchristoph
Posts: 5
Joined: Tue Feb 24, 2009 6:13 am

Re: JFileUpload, Forms and JSAPI

Post by cchristoph »

A workaround is to show the form and hide the applet. When the user click a button I set the extraParameters, disable the form and display the applet...
But you should consider to allow callback function.

Post Reply