JFileUpload, Forms and JSAPI

Upload core product.

JFileUpload, Forms and JSAPI

Postby cchristoph » Tue Feb 24, 2009 2:17 pm

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.
cchristoph
 
Posts: 4
Joined: Tue Feb 24, 2009 6:13 am

Re: JFileUpload, Forms and JSAPI

Postby support » Tue Feb 24, 2009 7:47 pm

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 ?
User avatar
support
 
Posts: 1398
Joined: Sun Jan 27, 2008 6:19 pm

Re: JFileUpload, Forms and JSAPI

Postby cchristoph » Wed Feb 25, 2009 6:26 am

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.
cchristoph
 
Posts: 4
Joined: Tue Feb 24, 2009 6:13 am

Re: JFileUpload, Forms and JSAPI

Postby support » Wed Feb 25, 2009 7:19 am

I see ... and can't you call setExtraParameter(name,value) before the end-user select files and upload ?
User avatar
support
 
Posts: 1398
Joined: Sun Jan 27, 2008 6:19 pm

Re: JFileUpload, Forms and JSAPI

Postby cchristoph » Wed Feb 25, 2009 7:26 am

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.
cchristoph
 
Posts: 4
Joined: Tue Feb 24, 2009 6:13 am


Return to JFileUpload



cron

Sitemap | Privacy Statement | Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc.
in the U.S. and other countries. All other company and/or product names are the property of their respective owners.