myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mario Ivankovits (JIRA)" <>
Subject [jira] Created: (MYFACES-1032) use a javascript method in commondLink for lesser html size
Date Mon, 16 Jan 2006 19:50:20 GMT
use a javascript method in commondLink for lesser html size

         Key: MYFACES-1032
     Project: MyFaces
        Type: Improvement
  Components: General  
    Reporter: Mario Ivankovits
 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'})"

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

The new javascript (rendered without any newline in reality)

function myfcs_sbmt(frm,srcElem,target,prms)
	var formElement = document.forms[frm];

	if (target != '')

	for (var paramName in prms)

		var result=formElement.onsubmit(); 
		if( (typeof result == 'undefined') || result )
	return false;

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message