[richfaces-issues] [JBoss JIRA] (RF-11990) client-side validation and ajax calls create maleformed javascript

Lukáš Fryč (JIRA) jira-events at lists.jboss.org
Mon Mar 26 11:38:49 EDT 2012


    [ https://issues.jboss.org/browse/RF-11990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12679336#comment-12679336 ] 

Lukáš Fryč edited comment on RF-11990 at 3/26/12 11:37 AM:
-----------------------------------------------------------

Following behavior reproduces the issue as well:
{code:java|title=Behavior1.java}
@FacesBehavior("eu.fryc.Behavior1")
public class Behavior1 extends ClientBehaviorBase {
    
    @Override
    public String getScript(ClientBehaviorContext behaviorContext) {
        return "alert('xyz')";
    }
}
{code}
{code:xml|title=META-INF/fryc.taglib.xml}
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
    version="2.0">

    <namespace>http://fryc.eu/behavior</namespace>
    <tag>
        <tag-name>behavior1</tag-name>
        <behavior>
            <behavior-id>eu.fryc.Behavior1</behavior-id>
        </behavior>
    </tag>
</facelet-taglib>
{code}
{code:XML|title=behavior-test.xhtml}
<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:fryc="http://fryc.eu/behavior">
<h:body>
    <h:inputText>
        <f:ajax event="change" />
        <fryc:behavior1 />
    </h:inputText>
</h:body>
</html>
{code}

It produces:

{code:XML|title=output}
<input id="j_id_3" name="j_id_3" type="text" value="" onchange="jsf.util.chain(document.getElementById('j_id_3'), event,'jsf.ajax.request(\'j_id_3\',event,{\'javax.faces.behavior.event\':\'change\'})''alert(\'xyz\')'); return false;" />
{code}
                
      was (Author: lfryc):
    Following behavior reproduces the issue as well:
{code:java}
@FacesBehavior("eu.fryc.Behavior1")
public class Behavior1 extends ClientBehaviorBase {
    
    @Override
    public String getScript(ClientBehaviorContext behaviorContext) {
        return "alert('xyz')";
    }
}
{code}
{code:xml}
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
    version="2.0">

    <namespace>http://fryc.eu/behavior</namespace>
    <tag>
        <tag-name>behavior1</tag-name>
        <behavior>
            <behavior-id>eu.fryc.Behavior1</behavior-id>
        </behavior>
    </tag>
</facelet-taglib>
{code}
{code:XML}
<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:fryc="http://fryc.eu/behavior">
<h:body>
    <h:inputText>
        <f:ajax event="change" />
        <fryc:behavior1 />
    </h:inputText>
</h:body>
</html>
{code}

It produces:

{code:XML}
<input id="j_id_3" name="j_id_3" type="text" value="" onchange="jsf.util.chain(document.getElementById('j_id_3'), event,'jsf.ajax.request(\'j_id_3\',event,{\'javax.faces.behavior.event\':\'change\'})''alert(\'xyz\')'); return false;" />
{code}
                  
> client-side validation and ajax calls create maleformed javascript
> ------------------------------------------------------------------
>
>                 Key: RF-11990
>                 URL: https://issues.jboss.org/browse/RF-11990
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-validators
>    Affects Versions: 4.0.0.Final, 4.1.0.Final
>         Environment: MyFaces 2.1.5, Hibernate-Validation 4.2.0.Final
>            Reporter: Daniel G
>            Assignee: Lukáš Fryč
>            Priority: Minor
>              Labels: javascript, myfaces, richfaces, validation
>             Fix For: 4.2.1.CR1
>
>
> Using rich:validation and f:ajax together, maleformed JavaScript is generated.
> I'm having a composite component, that has to be able to refresh given other components on change, but the JavaScript code generated by:
> {quote}
> <h:inputText id="input" value="#\{cc.attrs.value\}"
>         <f:ajax event="change" render="#\{cc.attrs.render\}" />
>         <rich:validator />
> </h:inputText>
> {quote}
> is missing a comma between the Chain parameters.
> see the red {color:red}'{color}
> {quote}
> <input id="idForm:bNr:input" name="idForm:bNr:input" type="text" value="123" 
> onchange="jsf.util.chain(document.getElementById('idForm:bNr:input'),
> event,'jsf.ajax.request(\'idForm:bNr:input\',event,\{render:\'idForm:idToolBar:idSaveButton\',\'javax.faces.behavior.event\':\'change\'\}){color:red}''{color}idForm_3AbNr_3Ainput_3Av(event,&quot;idForm:kopf:bezugNr:input&quot;,&quot;idForm:kopf:bezugNr:input&quot;)'); return false;" />
> {quote}
> the code is tanken from 4.0.0.Final, but looks similar in 4.1.0.Final

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the richfaces-issues mailing list