[ http://issues.apache.org/jira/browse/MYFACES-1032?page=comments#action_12433960 ] Martin Marinschek commented on MYFACES-1032: --------------------------------------------
Additional cleanup-commit: http://svn.apache.org/viewvc?view=rev&rev=442124 regards, Martin > use a javascript method in commondLink for lesser html size > ----------------------------------------------------------- > > Key: MYFACES-1032 > URL: http://issues.apache.org/jira/browse/MYFACES-1032 > Project: MyFaces Core > Issue Type: Improvement > Components: General > Reporter: Mario Ivankovits > Assigned To: Martin Marinschek > Fix For: 1.1.5-SNAPSHOT > > Attachments: onclick_method.diff > > > The attached patch will introduce a new javascript method which will be used > for the commandLink form submission handling. > The name of this new javascript method is "myfcs_sbmt" and will be rendered > once (on first use) into the html. > It allows to pass in 4 parameters: > frm - form name > srcElement - the element issuing the onclick - the anchor tag in the current > case > target - the target (not strictly necessary for the anchor, but useable for > the future (commandButton) ) > prms - a javascript hash array for the components f:params > See the resulting javascript below. > The resulting href-onclick tag will be > <a href="#" onclick="clear_navigation_3Atest();return > myfcs_sbmt('navigation:test',this,'',{'p1':'pv1','p2':'pv2'})" > id="navigation:test:_idJsp31">params</a> > Next thing to do will be to get rid of the clear_() method, but one after the > other. > It would be REALLY GREAT if one of you developers can have a look at this > (for sure) rather large patch. If you are happy it would be even MORE GREAT > if you could apply it so that I can see how it works in wild life. > If everything is fine I will have a look how to get rid of the clear_ methods > and move on to the commandButton. There is not much to win, but a little bit > is better than nothing ;-) > Especially it would be nice if both use the same (centralized) methods to > render their onClick things. > The new javascript (rendered without any newline in reality) > function myfcs_sbmt(frm,srcElem,target,prms) > { > var formElement = document.forms[frm]; > document.forms[frm].elements['autoScroll'].value=getScrolling(); > formElement.elements[frm+':_link_hidden_'].value=srcElem.id; > if (target != '') > { > formElement.target=target; > } > for (var paramName in prms) > { > formElement.elements[paramName].value=prms[paramName]; > } > if(formElement.onsubmit) > { > var result=formElement.onsubmit(); > if( (typeof result == 'undefined') || result ) > { > formElement.submit(); > } > } > else > { > formElement.submit(); > } > return false; > } -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
