That's an excellent idea. If I recall correctly ASP.NET is rendering this in a very similar fashion.
Cheers, Yee -----Original Message----- From: Simon Kitching [mailto:[EMAIL PROTECTED] Sent: Sunday, 15 January 2006 5:20 PM To: MyFaces Discussion Subject: Re: keep resulting html small (was: Re: commandLink) On Sun, 2006-01-15 at 09:12 +0100, Mario Ivankovits wrote: > Hi! > > <a href="#" > > onclick="clear__5Fid0();document.forms['_id0'].elements['autoScroll'].value= > > getScrolling();document.forms['_id0'].elements['_id0:_link_hidden_'].value=' > > _id0:pageID';if(document.forms['_id0'].onsubmit){if(document.forms['_id0'].o > > nsubmit()) > > document.forms['_id0'].submit();}else{document.forms['_id0'].submit();}retur > > n false;" id="_id0:pageID"></a > > > One thing which makes me felling a little bit uncomfortable is the size > of the resulting html file. > Say you have hundreds of command links in your jsf > (tree/datatable/navigation) especially a tree with client side > navigation tends to hold many entries - imagine the size of the > resulting html file with all this onclick= on each command link. > > Like the clear__ method we can render a submit__ javascript method which > wraps all this stuff, cant we? > > And maybe we can call this clear__ from within submit__ too, so this > makes the above url something like: > > > <a href="#" > > onclick="return submit__5Fid0()" id="_id0:pageID"></a > > > Or do I miss something? > If not, I'll prepare a patch for it. I'd really like to see this. It's been on my to-do list for a while. When a page has a large table containing a commandLink, the resulting html is currently *much* larger than it needs to be. Rather than "return submit__5Fid0()", I'd like to see: onclick="return myfaces_submit(this)" where the myfaces_submit function gets defined only once. Is there any reason not to do this? Note that there has recently been some discussion about "namespacing" javascript methods. However moving to at least *having* a single function definition is a good first step, even if "myfaces_submit" isn't the final way to access that function. Cheers, Simon

