Updating Applet param values with JavaScript

Enhanced frontend add-on to queue files.
Post Reply
onyii5119
Posts: 19
Joined: Sun Dec 20, 2009 6:27 pm

Updating Applet param values with JavaScript

Post by onyii5119 »

I have the following defined in my applet tag:

document.write('param2="username" ');
document.write('value2="test"');

document.writeln('<PARAM NAME="param2" VALUE="username">');
document.writeln('<PARAM NAME="value2" VALUE="test">');

If I have a JavaScript variable defined as follows for example:

var theUsername = "xxxxxx"; // This value is dynamically generated

How can I set the applet value2 to the value of theUsername before the user selects files to be uploaded? In other words VALUE="test" should be VALUE="xxxxxx" before the upload starts.

If it is not possible, please say so.

Thanks.

Jonathan

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

Re: Updating Applet param values with JavaScript

Post by support »

Try:
document.fileupload.setParameter("username","yourusername");

See: http://www.jfileupload.com/products/jfi ... aq.html#49

onyii5119
Posts: 19
Joined: Sun Dec 20, 2009 6:27 pm

Re: Updating Applet param values with JavaScript

Post by onyii5119 »

Thank you so much. It solved my problem for Firefox.

It seems not to work for IE 7. In IE 7, I get the debug message: Object doesn't support this property or method.

This how I defined it in Applet:

document.write('param2="username" ');
document.write('value2="test" ');

document.writeln('<PARAM NAME="param2" VALUE="username">');
document.writeln('<PARAM NAME="value2" VALUE="test">');

In JavaScript:
document.fileupload.setParameter("username","some-user-name");

Does it really work with IE 7? If it does what is wrong then?

Thanks.

Post Reply