Hi Arno,
So that's why setDefaultSelected() didn't work. I actually tried that but, like you, found it to behave oddly. Yes definitely post the patch. Actually, the best thing to do would be to post it to Apache's Bugzilla under a new bug entry so it doesn't get lost in the shuffle.
http://issues.apache.org/bugzilla/index.html
Then just post the link to the bug entry here for our reference.
One thing about setDefaultSelected(). Doesn't it assume that only one item in the list is selected? I haven't read the spec about this or anything, but it just seems to imply that. What if it is a multiply selected list? Does setDefaultSelected() really work for that case? Or does default not just imply one, but one or more defaults. Probably the latter, I guess.
While you are at it, can you add a patch in the javadoc for the setAttribute() method? It is decieving. Here is what I mentioned about it previously...
"BTW, the javadoc for that seems to be incorrect. It claims "If the value is true, the attribute is set to an empty string". That is, obviously, not the case. If the value is true, the attribute value is set to the value of the "name" parameter, which is the same as the attribute name. So, instead of <option selected ...>, as the javadoc seems to claim, it would be <option selected="selected" ...>. I'm actually not complaining about the behavior (I don't want that to change), I'm just saying that javadoc should be corrected to state what actually happens."
thanks,
Jake
At 08:35 AM 5/21/2003 +0200, Arno Schatz wrote:
Hi Jake,
(first question already answered by Michael.)
Jacob Kjome wrote:
A further question. Since Xerces2 seems to be doing the "correct" thing in distributing only the original html dom level1 standard interfaces rather than the level2, it seems that consumers of the interfaces ought to fall into line with the original standard, if possible. To that end, what is the appropriate change to make to the following code...
optionElement.setSelected(selectionModel.isSelectedIndex(i));
You are using a serverside API. The 'setSelected'-method really makes only sense on the client (that mean in the browser). The 'setDefaultSelected' method is what you should use. That what I got out from reading the spec.
That being said, I know, that the 'setDefaultSelected' is not fully implemented in the Xerces HTML DOM Implementation (that's what the comments in the source code say.) I have tested it with xmlc and plain Xerces yesterday and it did not behave correctly.
I think this is a bug, which just hasn't been detected, since people just used 'setSelected'. I will file a bug-report with a patch.
would it be?.....
if (selectionModel.isSelectedIndex(i)) optionElement.setAttribute("selected", "selected");
else optionElement.removeAttribute("selected");
This is of course a good workaround, since it is the code being executed internally anyway.
Or is there another way?
I patched setDefaultSelected, if you are interested, I can send you the patch.
-Arno
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
