[
https://issues.apache.org/jira/browse/MYFACES-2637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12852724#action_12852724
]
Werner Punz edited comment on MYFACES-2637 at 4/2/10 6:12 AM:
--------------------------------------------------------------
The code had an invalid positioned root form fallback it should be I assume
var sourceForm = null;
if ('undefined' != typeof context.source && null != context.source) {
sourceForm = myfaces._impl._util._Utils.getParent(null, context,
context.source, "form");
}
if ('undefined' == typeof sourceForm || null == sourceForm) {
sourceForm = document.forms.length > 0 ? document.forms[0]:null;
}
The old code was introduced in 908100 in February as rendering fix by someone
else.
(Before in my opinion it was correct except for the missing context source
check, which I am not even sure if it is needed)
I assume since the var declaration position was changed from top to the
position after the
if (which is semantically wrong bug syntactically correct) that this was a copy
paste error done by the person doing other small fixes in this commit.
I dont have time to test this yet, maybe later today or next week.
If you need it faster then give it a try yourself.
I will contact the committer to investigate what the reason for this change was.
Werner
was (Author: werpu):
The code had an invalid positioned root form fallback it should be I assume
var sourceForm = null;
if ('undefined' != typeof context.source || null != context.source) {
sourceForm = myfaces._impl._util._Utils.getParent(null, context,
context.source, "form");
}
if ('undefined' == typeof sourceForm || null == sourceForm) {
sourceForm = document.forms.length > 0 ? document.forms[0]:null;
}
The old code was introduced in 908100 in February as rendering fix by someone
else.
(Before in my opinion it was correct except for the missing context source
check, which I am not even sure if it is needed)
I assume since the var declaration position was changed from top to the
position after the
if (which is semantically wrong bug syntactically correct) that this was a copy
paste error done by the person doing other small fixes in this commit.
I dont have time to test this yet, maybe later today or next week.
If you need it faster then give it a try yourself.
I will contact the committer to investigate what the reason for this change was.
Werner
> Serious Bug! ajax cant work using multiple forms.
> -------------------------------------------------
>
> Key: MYFACES-2637
> URL: https://issues.apache.org/jira/browse/MYFACES-2637
> Project: MyFaces Core
> Issue Type: Bug
> Components: JSR-314
> Affects Versions: 2.0.0-beta-3
> Environment: tomcat 6.0.20, java 1.6 (mac osx)
> Reporter: Mark Li
> Priority: Blocker
> Original Estimate: 3h
> Remaining Estimate: 3h
>
> I am using multiple forms. the second form can submit correctly first time,
> but when you submit again, the ajax cant work.
> you can try following code, first time the form f1 can reRend out1, but then
> form f1 cant submit any more.
> test.jspx:
> <h:head>
> </h:head>
> <h:body>
> <h:outputScript name="jsf.js" library="javax.faces"
> target="head"/>
>
> <h:form id="f0">
> </h:form>
> <h:form id="f1">
> <h:inputText value="#{TestBean.value}"/>
> <h:outputText id="out1" value="#{TestBean.value}"/>
> <h:commandButton value="click me"
> onclick="jsf.ajax.request(this,event,{execute:'@form',
> render:'@form'});return false;"></h:commandButton>
> </h:form>
> </h:body>
> The reason i find is that:
> during the first time submit and ajax rendering, the form will lose <input
> type="hidden" id="javax.faces.ViewState"/> childnode. Then the following
> submit will not work.
> the code in jsf.js causes this problem:
> jsf.js:
> myfaces._impl.xhrCore._AjaxResponse.prototype.processUpdate = function
> (request, context, node) {
> if (node.getAttribute("id") == "javax.faces.ViewState") {
> sourceForm = document.forms.length > 0 ? document.forms[0] : null;
> ....
> }
> " sourceForm = document.forms.length > 0 ? document.forms[0] : null; " is
> wrong!
> when there is multiple forms, it will always find the first one.
> Please change this, thx.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.