[ https://issues.apache.org/jira/browse/MYFACES-4636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17781339#comment-17781339 ]
Werner Punz edited comment on MYFACES-4636 at 10/31/23 12:52 PM: ----------------------------------------------------------------- This seems to be an issue in the java renderer, the analysis is correct, the chain function is wrongly constructed! a comma is missing after testJs! Afair when I did the 4.0 javascripts I noticed that the spec passing the params has changed slightly, i adapted the code, you now can and should pass params maps via params: <paramsmap> instead of just passing the map! I left the way how we did it in the past open, but it seems there was a slight mistake in the changes in the java renderer adapting to the spec conform api! was (Author: werpu): This seems to be an issue in the java renderer, the analysis is correct, the chain function is wrongly constructed! a comma is missing after testJs! > Using f:param + f:ajax onvent results in an error > ------------------------------------------------- > > Key: MYFACES-4636 > URL: https://issues.apache.org/jira/browse/MYFACES-4636 > Project: MyFaces Core > Issue Type: Bug > Affects Versions: 2.3-next-M8 > Reporter: Vitaly Sidorov > Priority: Major > Attachments: sample.zip > > > *Steps to reproduce:* > - create xhtml with f:param and f:ajax onevent like this: > > {code:html} > <h:form prependId="false"> > <h:commandLink action="#{sampleBean.doAction}"> > <h:outputText value="Click Me!"/> > <f:param name="var1" value="NEW VALUE"/> > <f:ajax event="click" > execute="@this" > onevent="testJs"> > </f:ajax> > </h:commandLink> > </h:form> > <script> > //<![CDATA[ > function testJs(data) { > if (data.status === 'success') { > alert("Success click") > } > } > //]]> > </script> > {code} > > - click on "Click me" > - get an error in the console: "{color:#FF0000}Uncaught SyntaxError: > Unexpected token ':' (at index.xhtml:9:868){color}" > *The reason:* > Generated page code by M7 build: > {code:javascript} > jsf.util.chain(this, > event,function(event){myfaces.ab(this,event,'click','j_id_i','',{'onevent':testJs,'var1':'NEW > VALUE'})}); return false; > {code} > Generated page code by M8 build with *bad JS* (look at {*}testJsparams{*}): > {code:javascript} > jsf.util.chain(this, > event,function(event){myfaces.ab(this,event,'click','j_id_i','',{'onevent':testJsparams:{'var1':'NEW > VALUE'}})}); return false; > {code} > *I've attached an archive with an example.* -- This message was sent by Atlassian Jira (v8.20.10#820010)