You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by mjovanov <mi...@jpmchase.com> on 2008/04/15 23:42:41 UTC

Popups Broken After Upgrade to MyFaces 1.2.2

I upgraded from MyFaces 1.1.4 to 1.2.2 only to find out all the popups used
throughout the app would no longer open; instead, a blank popup page
appeared along with an indication of a JavaScript error. I believe the issue
is related to a change in the MyFaces auto-generated JavaScript; here is a
small demo app that demonstrated the problem:

popupDemo.xhtml:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:t="http://myfaces.apache.org/tomahawk">
<head>
<script language="JavaScript1.1">
	/* <![CDATA[ */
			function doPopup(height,width,form,target) {
				var xOffset = (height - 300)/2, yOffset = (width - 690)/2;			    
				features="height=" + height + ",width=" + width +
",screenX="+xOffset+",screenY="+yOffset+",top="+
				yOffset+",left="+xOffset+",menubar=no,titlebar=no,scrollbars=yes";
				 popup = window.open("", "popup", features);
				//popup.openerFormId = source.form.id;
				
				popup.focus();				
			    var hidden = document.forms.hidden;			    
				// Unlike the Sun JSF Reference Impl, My Faces generates _link_hidden 
				// input field for each invisible link; the following line is used to
				// emulate the action link being clicked.
	              hidden[form+":_link_hidden_"].value = form+":"+target;			   			
				//hidden["hidden:param"].value = form+":"+target;
				// Submit the hidden form. The output will be sent to the just opened
window.
			    hidden.submit();
			}

	/* ]]> */ 
	</script>
<title>Popup Demo Page</title>
</head>
<body>
<h:form>
	<h:commandButton value="..." immediate="true"
		onmousedown="doPopup(590,690,'hidden','goTestPopup')"
		onclick="return false" />
</h:form>
<!-- This hidden form sends a request to a popup window. -->
<h:form id="hidden" target="popup">
	<!-- The hidden input field(s) bellow can be used to 
			     pass info from the parent page to the popup. -->
	<!-- h:inputHidden id="param" value="" / -->
	<!-- The action attribute of the command link bellow 
				 is used by the JSF navigation handler to select
				 the JSF page that generates the popup contents. -->
	<h:commandLink id="goTestPopup" action="testPopup" value="">
		<f:verbatim />
	</h:commandLink>
</h:form>
</body>
</html>

Can anyone please suggest a solution? I am not a JavaScript expert, and the
code used to open popups was copied from an example in the Core JSF book.

Many thanks,

Mihajlo
-- 
View this message in context: http://www.nabble.com/Popups-Broken-After-Upgrade-to-MyFaces-1.2.2-tp16711347p16711347.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Popups Broken After Upgrade to MyFaces 1.2.2

Posted by mjovanov <mi...@jpmchase.com>.

Leonardo Uribe wrote:
> 
> On Tue, Apr 15, 2008 at 4:42 PM, mjovanov <mi...@jpmchase.com>
> wrote:
> 
>>
>> I upgraded from MyFaces 1.1.4 to 1.2.2 only to find out all the popups
>> used
>> throughout the app would no longer open; instead, a blank popup page
>> appeared along with an indication of a JavaScript error. I believe the
>> issue
>> is related to a change in the MyFaces auto-generated JavaScript; here is
>> a
>> small demo app that demonstrated the problem:
>>
>> popupDemo.xhtml:
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>
>> <html xmlns="http://www.w3.org/1999/xhtml"
>>        xmlns:h="http://java.sun.com/jsf/html"
>>        xmlns:f="http://java.sun.com/jsf/core"
>>        xmlns:c="http://java.sun.com/jstl/core"
>>        xmlns:t="http://myfaces.apache.org/tomahawk">
>> <head>
>> <script language="JavaScript1.1">
>>        /* <![CDATA[ */
>>                        function doPopup(height,width,form,target) {
>>                                var xOffset = (height - 300)/2, yOffset =
>> (width - 690)/2;
>>                                features="height=" + height + ",width=" +
>> width +
>> ",screenX="+xOffset+",screenY="+yOffset+",top="+
>>
>>  yOffset+",left="+xOffset+",menubar=no,titlebar=no,scrollbars=yes";
>>                                 popup = window.open("", "popup",
>> features);
>>                                //popup.openerFormId = source.form.id;
>>
>>                                popup.focus();
>>                            var hidden = document.forms.hidden;
>>                                // Unlike the Sun JSF Reference Impl, My
>> Faces generates _link_hidden
>>                                // input field for each invisible link;
>> the
>> following line is used to
>>                                // emulate the action link being clicked.
>>                      hidden[form+":_link_hidden_"].value =
>> form+":"+target;
>>                                //hidden["hidden:param"].value =
>> form+":"+target;
>>                                // Submit the hidden form. The output will
>> be sent to the just opened
>> window.
>>                            hidden.submit();
>>                        }
>>
>>        /* ]]> */
>>        </script>
>> <title>Popup Demo Page</title>
>> </head>
>> <body>
>> <h:form>
>>        <h:commandButton value="..." immediate="true"
>>                onmousedown="doPopup(590,690,'hidden','goTestPopup')"
>>                onclick="return false" />
>> </h:form>
>> <!-- This hidden form sends a request to a popup window. -->
>> <h:form id="hidden" target="popup">
>>        <!-- The hidden input field(s) bellow can be used to
>>                             pass info from the parent page to the popup.
>> -->
>>        <!-- h:inputHidden id="param" value="" / -->
>>        <!-- The action attribute of the command link bellow
>>                                 is used by the JSF navigation handler to
>> select
>>                                 the JSF page that generates the popup
>> contents. -->
>>        <h:commandLink id="goTestPopup" action="testPopup" value="">
>>                <f:verbatim />
>>        </h:commandLink>
>> </h:form>
>> </body>
>> </html>
>>
>> Can anyone please suggest a solution? I am not a JavaScript expert, and
>> the
>> code used to open popups was copied from an example in the Core JSF book.
>>
> 
> form:_link_hidden_ is obsolete and was replaced by form:_idcl.
> 
> The better for do this is use  a popup component, like t:popup in tomahawk
> or tr:panelPopup in trinidad.
> 
> You can see the tomahawk example here:
> 
> http://www.irian.at/myfacesexamples/popup.jsf
> 
> 
>> Many thanks,
>>
>> Mihajlo
>> --
>> View this message in context:
>> http://www.nabble.com/Popups-Broken-After-Upgrade-to-MyFaces-1.2.2-tp16711347p16711347.html
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

Thanks I appreciate your response. I was able to resolve the problem by
replacing the following line in my JS code:

  hidden[form+":_link_hidden_"].value = form+":"+target;

with this:

  oamSetHiddenInput('hidden','hidden:_idcl',form+":"+target);		   			

btw: a while ago I looked at the tomahawk t:popup component but it didn't
seem to fit our requirements. We needed a classic old-style popup page for
additional searches/etc, while t:popup seems to be more applicable for
comments and other things of that sort. As far as Trinidad components are
concerned: I would love to be able to use some of them but am not sure how
much effort would it be to integrate them in our app (we currently use
exclusively tomahawk components and some custom ones).
-- 
View this message in context: http://www.nabble.com/Popups-Broken-After-Upgrade-to-MyFaces-1.2.2-tp16711347p16722556.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Popups Broken After Upgrade to MyFaces 1.2.2

Posted by Leonardo Uribe <lu...@gmail.com>.
On Tue, Apr 15, 2008 at 4:42 PM, mjovanov <mi...@jpmchase.com>
wrote:

>
> I upgraded from MyFaces 1.1.4 to 1.2.2 only to find out all the popups
> used
> throughout the app would no longer open; instead, a blank popup page
> appeared along with an indication of a JavaScript error. I believe the
> issue
> is related to a change in the MyFaces auto-generated JavaScript; here is a
> small demo app that demonstrated the problem:
>
> popupDemo.xhtml:
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml"
>        xmlns:h="http://java.sun.com/jsf/html"
>        xmlns:f="http://java.sun.com/jsf/core"
>        xmlns:c="http://java.sun.com/jstl/core"
>        xmlns:t="http://myfaces.apache.org/tomahawk">
> <head>
> <script language="JavaScript1.1">
>        /* <![CDATA[ */
>                        function doPopup(height,width,form,target) {
>                                var xOffset = (height - 300)/2, yOffset =
> (width - 690)/2;
>                                features="height=" + height + ",width=" +
> width +
> ",screenX="+xOffset+",screenY="+yOffset+",top="+
>
>  yOffset+",left="+xOffset+",menubar=no,titlebar=no,scrollbars=yes";
>                                 popup = window.open("", "popup",
> features);
>                                //popup.openerFormId = source.form.id;
>
>                                popup.focus();
>                            var hidden = document.forms.hidden;
>                                // Unlike the Sun JSF Reference Impl, My
> Faces generates _link_hidden
>                                // input field for each invisible link; the
> following line is used to
>                                // emulate the action link being clicked.
>                      hidden[form+":_link_hidden_"].value =
> form+":"+target;
>                                //hidden["hidden:param"].value =
> form+":"+target;
>                                // Submit the hidden form. The output will
> be sent to the just opened
> window.
>                            hidden.submit();
>                        }
>
>        /* ]]> */
>        </script>
> <title>Popup Demo Page</title>
> </head>
> <body>
> <h:form>
>        <h:commandButton value="..." immediate="true"
>                onmousedown="doPopup(590,690,'hidden','goTestPopup')"
>                onclick="return false" />
> </h:form>
> <!-- This hidden form sends a request to a popup window. -->
> <h:form id="hidden" target="popup">
>        <!-- The hidden input field(s) bellow can be used to
>                             pass info from the parent page to the popup.
> -->
>        <!-- h:inputHidden id="param" value="" / -->
>        <!-- The action attribute of the command link bellow
>                                 is used by the JSF navigation handler to
> select
>                                 the JSF page that generates the popup
> contents. -->
>        <h:commandLink id="goTestPopup" action="testPopup" value="">
>                <f:verbatim />
>        </h:commandLink>
> </h:form>
> </body>
> </html>
>
> Can anyone please suggest a solution? I am not a JavaScript expert, and
> the
> code used to open popups was copied from an example in the Core JSF book.
>

form:_link_hidden_ is obsolete and was replaced by form:_idcl.

The better for do this is use  a popup component, like t:popup in tomahawk
or tr:panelPopup in trinidad.

You can see the tomahawk example here:

http://www.irian.at/myfacesexamples/popup.jsf


> Many thanks,
>
> Mihajlo
> --
> View this message in context:
> http://www.nabble.com/Popups-Broken-After-Upgrade-to-MyFaces-1.2.2-tp16711347p16711347.html
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>