Hi,
A typical field would be retrieved as a JSObject using the Java method
loadJSTextField shown below, passing in for example document.forms
[0].elements['jobDescription.ID'] as the fieldName.
I then use returnedJSObject.setMember("value", "newValue") to set the new
value. Reading values is achieved via getMember("value");
The problem is occuring in IE6. It doesn't work full stop in Netscape 4.6
but that's another story and it's only a requirement that it works in IE.
I've just downloaded the lastest netscape.javascript.classes in the hope
that this fixes the problem. It's a hard thing to test as, like I said,
it work's 90% of the time, it's just on the odd occasion it writes to the
wrong field.
Any help will be greatly appreciated.
private JSObject loadJSTextField(String fieldName) {
JSObject jsElement;
try {
// Get root.
jsElement = (JSObject) JSObject.getWindow(this);
// Check for null field name.
if (fieldName == null || fieldName.trim().equals(""))
return null;
jsElement = (JSObject) jsElement.eval(fieldName);
// Return reference.
return jsElement;
} catch (Exception jsExp) {
return null;
}
}
Martin Honnen <ma*******@yahoo.de> wrote in
news:40********@olaf.komtel.net:
Alan Pocklington wrote:
I've created a Java Applet that allows the user to select a record.
As the user makes the selection, the applet uses LiveConnect
(JSObject) to write the record id to a html field (the name of which
is passed in to the applet as an arg).
This all works fine, but now I have two instances of the same applet
running on a page, both linked to different HTML fields so that
making a selection from applet 1 updates html field 1, a selection
from applet 2 updates html field 2. This works for 90% of the time.
However, on the odd occasion one of the applets will write to the
other applet's field (and the other will continue to work normally).
Refresh the page and everything works fine again.
I'm not sure why this is happening and it is driving me crazy! I
wondered if anyone else has run into the same problem.
How do you identify and access the HTML "fields"? Are those form
fields? Is the problem happening with a particular browser?