I haven't used AJAX, but isn't the javascript concerned *generated* by JSF tags? If so, the generated javascript should be able to create
  document.getElementById("form1:subview2:button1")

Or is it that AJAX is commonly combined with user-provided javascript that manipulates the same DOM components in the page? If so, then how about providing some kind of bridge between the two worlds rather than forcing JSF to use non-nested ids. Here's a proposal off the top of my head:
  <t:ajaxInputText ajaxId="foo"/>
  <t:axajInputText ajaxId="bar"/>
causes this to be emitted into the page to map convenient names for user scripts through to the real JSF ids.
 <script>
 var AJAX = new Object();
 AJAX.foo = document.getElementById("form1:subview2:foo");
 AJAX.bar = document.getElementById("form2:subview2:bar");
 </script>
User code can then use:
  AJAX.foo
rather than
  document.foo
while JSF ids are completely unaffected.

Of course there are probably good reasons against this which were pointed out in the ajax thread that I haven't found time to read yet. Sorry if this is the case.

Cheers,

Simon

Adam Winer wrote:
I think Simon's question is not about why "forceId" exists
in the first place, but why AJAX would *require* its use.

The former was discussed long ago.  The latter is a new
question which deserves careful consideration.

-- Adam


On 11/23/05, Sean Schofield <[EMAIL PROTECTED]> wrote:
Simon,

There are a few very long threads on this in the archives (when
forceId first came about.)  Not only is it awkward to add
"form1:subview2" etc to every reference in your javascript but if you
change your JSF form structure all of your javascript needs to change
too!  (NOTE: Its not always practical to have your component generate
your javascript.)

Again, see the archived discussions for more on the reasoning.  It was
a pretty lively debate with lots of good points raised on all sides.

sean

On 11/22/05, Simon Kitching <[EMAIL PROTECTED]> wrote:
Hi Travis,

I don't know anything about the AJAX compoents so please excuse me if
this is a silly question. But why are the AJAX components requiring
"forceId" in the first place?

If a component's true id at the back end is "form1:subview2:table3",
then why not use that id in all the AJAX stuff rather than requiring the
table to use forceId?

Travis Reeder wrote:
Yes, I can use forceId=true when I want it, but my sentiments exactly
(about altering the id), if I set an ID, it would be nice to not have
to set forceId="true" also.  Especially in this new rich client /
ajaxing era that we seem to be rolling into.


Reply via email to