Page 1 of 1

Updating Applet param values with JavaScript

Posted: Sat Dec 26, 2009 2:54 am
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

Re: Updating Applet param values with JavaScript

Posted: Sat Dec 26, 2009 5:16 pm
by support
Try:
document.fileupload.setParameter("username","yourusername");

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

Re: Updating Applet param values with JavaScript

Posted: Sun Dec 27, 2009 1:57 am
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.