Page 1 of 1

JFileUpload, Forms and JSAPI

Posted: Tue Feb 24, 2009 2:17 pm
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.

Re: JFileUpload, Forms and JSAPI

Posted: Tue Feb 24, 2009 7:47 pm
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 ?

Re: JFileUpload, Forms and JSAPI

Posted: Wed Feb 25, 2009 6:26 am
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.

Re: JFileUpload, Forms and JSAPI

Posted: Wed Feb 25, 2009 7:19 am
by support
I see ... and can't you call setExtraParameter(name,value) before the end-user select files and upload ?

Re: JFileUpload, Forms and JSAPI

Posted: Wed Feb 25, 2009 7:26 am
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.