myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ganesh Jung (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-2599) ajax javascript checks for existence of triggering html element
Date Sat, 13 Mar 2010 13:51:27 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-2599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12844875#action_12844875
] 

Ganesh Jung commented on MYFACES-2599:
--------------------------------------

Hi,

This may be a Mojarra bug. Here's the complete JSF page:

<?xml version='1.0' encoding='UTF-8' ?> 
<!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:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:test="http://j4fry.org/test"
      xmlns:ui="http://java.sun.com/jsf/facelets">   
    <h:head>
    </h:head>
	<h:body>
		<h:form id="testForm">
	 		<h:inputText id="test" value="#{myBean.test}" >
				<f:ajax render="test2"/>
	    	</h:inputText>
			<h:inputText id="test2" value="#{myBean.test}" />
		    <script type="text/javascript">
				//<![CDATA[
	    		var myTest = document.getElementById("testForm:test");
	    		var test_onchange = myTest.onchange;
	    		myTest.parentNode.removeChild(myTest);
	    		test_onchange();
				//]]>
			</script>
		</h:form>
	</h:body>
</html>

This is what Mojarra renders:

<?xml version='1.0' encoding='UTF-8' ?>
<!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:test="http://j4fry.org/test"><head><script
type="text/javascript" src="/MyFaces_Test/javax.faces.resource/jsf.js.faces?ln=javax.faces&amp;stage=Development"></script></head><body>
<form id="testForm" name="testForm" method="post" action="/MyFaces_Test/test.faces" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="testForm" value="testForm" />
<input id="testForm:test" type="text" name="testForm:test" onchange="mojarra.ab(this,event,'valueChange',0,'testForm:test2')"
/><input id="testForm:test2" type="text" name="testForm:test2" />
		    <script type="text/javascript">
				//<![CDATA[
	    		var myTest = document.getElementById("testForm:test");
	    		var test_onchange = myTest.onchange;
	    		myTest.parentNode.removeChild(myTest);
	    		test_onchange();
				//]]>
			</script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState"
value="6029528549350253333:3893928850842459042" autocomplete="off" />
</form></body>
</html>

And this comes from MyFaces:

<?xml version='1.0' encoding='UTF-8' ?>
<!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:test="http://j4fry.org/test"><head><script
type="text/javascript" src="/MyFaces_Test/javax.faces.resource/jsf.js.faces?ln=javax.faces&amp;stage=Development"><!--

//--></script></head><body><form id="testForm" name="testForm" method="post"
action="/MyFaces_Test/test.faces" enctype="application/x-www-form-urlencoded"><input
id="testForm:test" name="testForm:test" type="text" value="" onchange="jsf.ajax.request('testForm:test',event,{render:'testForm:test2','javax.faces.behavior.event':'valueChange'})"
/><input id="testForm:test2" name="testForm:test2" type="text" value="" />
		    <script type="text/javascript"><!--

				//<![CDATA[
	    		var myTest = document.getElementById("testForm:test");
	    		var test_onchange = myTest.onchange;
	    		myTest.parentNode.removeChild(myTest);
	    		test_onchange();
				//]]>
			
//--></script><input type="hidden" name="testForm_SUBMIT" value="1" /><input
type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="6i+F2RXTsgQcdsJUaKbiNDmHdBRLSokazvKwAm3io9INMDNU5oJjy+lp2N+BU0uIYEY+Lln2dLFmMvvL69XLkQ=="
/></form></body>
</html>

MyFaces throws a JavaScript error, Mojarra doesn't.

> ajax javascript checks for existence of triggering html element
> ---------------------------------------------------------------
>
>                 Key: MYFACES-2599
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2599
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: JSR-314
>    Affects Versions: 2.0.0-beta-2
>         Environment: Javascript
>            Reporter: Ganesh Jung
>
> This one is a bit special. I remove the triggering element from the DOM, afterwards I
trigger it's onchange method. Works with Mojarra, but MyFaces insists, that the triggering
element must exist in the DOM, though this isn't necessary from the spec.
> 		<h:form id="testForm">
> 	 		<h:inputText id="test" value="#{myBean.test}" >
> 				<f:ajax render="test2"/>
> 	    	</h:inputText>
> 			<h:inputText id="test2" value="#{myBean.test}" />
> 		    <script type="text/javascript">
> 				//<![CDATA[
> 	    		var myTest = document.getElementById("testForm:test");
> 	    		var test_onchange = myTest.onchange;
> 	    		myTest.parentNode.removeChild(myTest);
> 	    		test_onchange();
> 				//]]>
> 			</script>
> 		</h:form>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message