You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Bas Velthuizen (JIRA)" <de...@myfaces.apache.org> on 2008/06/30 13:39:45 UTC

[jira] Created: (TOMAHAWK-1292) Javascript for input elements is wrong

Javascript for input elements is wrong
--------------------------------------

                 Key: TOMAHAWK-1292
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1292
             Project: MyFaces Tomahawk
          Issue Type: Bug
    Affects Versions: 1.1.6
         Environment: Java JDK 5.0, Tomcat 6.0 MyFaces 1.1.5, Tomahawk 1.1.6
            Reporter: Bas Velthuizen


I've created a simple login-page with a username and password and a submit-button (see code below)

    <h:form id="loginForm">
      <t:div id="login" forceId="true">
        <t:div id="errorMessages">
          <t:messages id="messages" showSummary="true" showDetail="false" layout="list" />
        </t:div>
        <t:div styleClass="formRow">
          <h:outputLabel id="usernameLabel" for="username" styleClass="label" value="#{msg.username}" />
          <t:inputText id="username" styleClass="value" value="#{loginController.username}" required="true" forceId="true">
            <t:validateRegExpr pattern="\w+" summaryMessage="#{msg.illegal_username}" />
            <f:attribute name="name" value="username" />
          </t:inputText>
          <t:div styleClass="spacer">&nbsp;</t:div>
        </t:div>
        <t:div styleClass="formRow">
          <h:outputLabel id="passwordLabel" for="password" styleClass="label" value="#{msg.password}" />
          <t:inputSecret id="password" styleClass="value" value="#{loginController.passWord}" required="true" forceId="true">
            <t:validateRegExpr pattern="\S+" summaryMessage="#{msg.illegal_password}" />
            <f:attribute name="name" value="password" />
          </t:inputSecret>
          <t:div styleClass="spacer">&nbsp;</t:div>
        </t:div>
        <t:div styleClass="commands">
          <t:commandButton id="submit" action="#{loginController.doLogin}" value="#{msg.submit}" />
        </t:div>
      </t:div>
    </h:form>

When this code is rendered in myfaces, a javascript-function is generated that looks like the following:

<script type="text/javascript" >
	 tomahawk.createView = function(facesContext) {
		 facesContext.clearMessages();
		 facesContext.viewRoot = new tomahawk.UIViewRoot();
		 facesContext.viewRoot.addChild((new tomahawk.UIInput('username','username',true,null,new Array(new null ) ) ) );
		 facesContext.viewRoot.addChild((new tomahawk.UIInput('password','password',true,null,new Array(new null ) ) ) );
	 }
	 tomahawk.renderResponse = function(facesContext) {
		 var uimessages = new tomahawk.UIMessages('loginForm:messages','list',true,false);
		 tomahawk.RendererUtils.renderMessages(facesContext,uimessages); 
		 viewRoot = facesContext.viewRoot;
		 for(var i = 0; i < viewRoot.children.length ; i ++) { 
				  var uiinput = viewRoot.children[i]; 
				 tomahawk.RendererUtils.renderMessage(facesContext,uiinput.clientId); 
			 }
		 }
</script>

In the tomahawk.createView function, two UIInput elements are created, with at the end of the paramer list (I believe something with a validator list): 

new Array(new null )

This generates a javascript error when the form is submitted, in firefox3 als well as in IE7.
The form is working, but I don't know what the real effects are of this bug, except an inappropriate error dialog in IE.

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


[jira] Commented: (TOMAHAWK-1292) Javascript for input elements is wrong

Posted by "Simon Kitching (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609211#action_12609211 ] 

Simon Kitching commented on TOMAHAWK-1292:
------------------------------------------

This javascript appears to be coming from the "client validation framework" stuff in the myfaces sandbox:
    sandbox/core/src/main/java/org/apache/myfaces/custom/clientvalidation/common/CVUtils.java

I don't know much about that, but it isn't normally enabled. Have you deliberately enabled this (eg via a config param in your web.xml)?
This isn't an official part of tomahawk (sandbox stuff is by definition experimental).

> Javascript for input elements is wrong
> --------------------------------------
>
>                 Key: TOMAHAWK-1292
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1292
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>    Affects Versions: 1.1.6
>         Environment: Java JDK 5.0, Tomcat 6.0 MyFaces 1.1.5, Tomahawk 1.1.6
>            Reporter: Bas Velthuizen
>
> I've created a simple login-page with a username and password and a submit-button (see code below)
>     <h:form id="loginForm">
>       <t:div id="login" forceId="true">
>         <t:div id="errorMessages">
>           <t:messages id="messages" showSummary="true" showDetail="false" layout="list" />
>         </t:div>
>         <t:div styleClass="formRow">
>           <h:outputLabel id="usernameLabel" for="username" styleClass="label" value="#{msg.username}" />
>           <t:inputText id="username" styleClass="value" value="#{loginController.username}" required="true" forceId="true">
>             <t:validateRegExpr pattern="\w+" summaryMessage="#{msg.illegal_username}" />
>             <f:attribute name="name" value="username" />
>           </t:inputText>
>           <t:div styleClass="spacer">&nbsp;</t:div>
>         </t:div>
>         <t:div styleClass="formRow">
>           <h:outputLabel id="passwordLabel" for="password" styleClass="label" value="#{msg.password}" />
>           <t:inputSecret id="password" styleClass="value" value="#{loginController.passWord}" required="true" forceId="true">
>             <t:validateRegExpr pattern="\S+" summaryMessage="#{msg.illegal_password}" />
>             <f:attribute name="name" value="password" />
>           </t:inputSecret>
>           <t:div styleClass="spacer">&nbsp;</t:div>
>         </t:div>
>         <t:div styleClass="commands">
>           <t:commandButton id="submit" action="#{loginController.doLogin}" value="#{msg.submit}" />
>         </t:div>
>       </t:div>
>     </h:form>
> When this code is rendered in myfaces, a javascript-function is generated that looks like the following:
> <script type="text/javascript" >
> 	 tomahawk.createView = function(facesContext) {
> 		 facesContext.clearMessages();
> 		 facesContext.viewRoot = new tomahawk.UIViewRoot();
> 		 facesContext.viewRoot.addChild((new tomahawk.UIInput('username','username',true,null,new Array(new null ) ) ) );
> 		 facesContext.viewRoot.addChild((new tomahawk.UIInput('password','password',true,null,new Array(new null ) ) ) );
> 	 }
> 	 tomahawk.renderResponse = function(facesContext) {
> 		 var uimessages = new tomahawk.UIMessages('loginForm:messages','list',true,false);
> 		 tomahawk.RendererUtils.renderMessages(facesContext,uimessages); 
> 		 viewRoot = facesContext.viewRoot;
> 		 for(var i = 0; i < viewRoot.children.length ; i ++) { 
> 				  var uiinput = viewRoot.children[i]; 
> 				 tomahawk.RendererUtils.renderMessage(facesContext,uiinput.clientId); 
> 			 }
> 		 }
> </script>
> In the tomahawk.createView function, two UIInput elements are created, with at the end of the paramer list (I believe something with a validator list): 
> new Array(new null )
> This generates a javascript error when the form is submitted, in firefox3 als well as in IE7.
> The form is working, but I don't know what the real effects are of this bug, except an inappropriate error dialog in IE.

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


[jira] Commented: (TOMAHAWK-1292) Javascript for input elements is wrong

Posted by "Bas Velthuizen (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609215#action_12609215 ] 

Bas Velthuizen commented on TOMAHAWK-1292:
------------------------------------------

eeehm..  you mean the org.apache.myfaces.ENABLE_CLIENT_SIDE_VALIDATION parameter?

Yes, that has been enabled. It was not clear to me that that was a parameter that belongs to the sandbox.
When I set the org.apache.myfaces.ENABLE_CLIENT_SIDE_VALIDATION parameter to false, the error indeed does not occur.
Thank you for the work around.

So actually this bug should go to the asandbox people ;)

Cheers,
Bas

> Javascript for input elements is wrong
> --------------------------------------
>
>                 Key: TOMAHAWK-1292
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1292
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>    Affects Versions: 1.1.6
>         Environment: Java JDK 5.0, Tomcat 6.0 MyFaces 1.1.5, Tomahawk 1.1.6
>            Reporter: Bas Velthuizen
>
> I've created a simple login-page with a username and password and a submit-button (see code below)
>     <h:form id="loginForm">
>       <t:div id="login" forceId="true">
>         <t:div id="errorMessages">
>           <t:messages id="messages" showSummary="true" showDetail="false" layout="list" />
>         </t:div>
>         <t:div styleClass="formRow">
>           <h:outputLabel id="usernameLabel" for="username" styleClass="label" value="#{msg.username}" />
>           <t:inputText id="username" styleClass="value" value="#{loginController.username}" required="true" forceId="true">
>             <t:validateRegExpr pattern="\w+" summaryMessage="#{msg.illegal_username}" />
>             <f:attribute name="name" value="username" />
>           </t:inputText>
>           <t:div styleClass="spacer">&nbsp;</t:div>
>         </t:div>
>         <t:div styleClass="formRow">
>           <h:outputLabel id="passwordLabel" for="password" styleClass="label" value="#{msg.password}" />
>           <t:inputSecret id="password" styleClass="value" value="#{loginController.passWord}" required="true" forceId="true">
>             <t:validateRegExpr pattern="\S+" summaryMessage="#{msg.illegal_password}" />
>             <f:attribute name="name" value="password" />
>           </t:inputSecret>
>           <t:div styleClass="spacer">&nbsp;</t:div>
>         </t:div>
>         <t:div styleClass="commands">
>           <t:commandButton id="submit" action="#{loginController.doLogin}" value="#{msg.submit}" />
>         </t:div>
>       </t:div>
>     </h:form>
> When this code is rendered in myfaces, a javascript-function is generated that looks like the following:
> <script type="text/javascript" >
> 	 tomahawk.createView = function(facesContext) {
> 		 facesContext.clearMessages();
> 		 facesContext.viewRoot = new tomahawk.UIViewRoot();
> 		 facesContext.viewRoot.addChild((new tomahawk.UIInput('username','username',true,null,new Array(new null ) ) ) );
> 		 facesContext.viewRoot.addChild((new tomahawk.UIInput('password','password',true,null,new Array(new null ) ) ) );
> 	 }
> 	 tomahawk.renderResponse = function(facesContext) {
> 		 var uimessages = new tomahawk.UIMessages('loginForm:messages','list',true,false);
> 		 tomahawk.RendererUtils.renderMessages(facesContext,uimessages); 
> 		 viewRoot = facesContext.viewRoot;
> 		 for(var i = 0; i < viewRoot.children.length ; i ++) { 
> 				  var uiinput = viewRoot.children[i]; 
> 				 tomahawk.RendererUtils.renderMessage(facesContext,uiinput.clientId); 
> 			 }
> 		 }
> </script>
> In the tomahawk.createView function, two UIInput elements are created, with at the end of the paramer list (I believe something with a validator list): 
> new Array(new null )
> This generates a javascript error when the form is submitted, in firefox3 als well as in IE7.
> The form is working, but I don't know what the real effects are of this bug, except an inappropriate error dialog in IE.

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


[jira] Commented: (TOMAHAWK-1292) Javascript for input elements is wrong

Posted by "Bas Velthuizen (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12609207#action_12609207 ] 

Bas Velthuizen commented on TOMAHAWK-1292:
------------------------------------------

As a secondary test, I changed the inputText and inputSecret inputs from t: namespace to h: namespace and removed the forceId attributes.

        <t:div styleClass="formRow">
          <h:outputLabel id="usernameLabel" for="username" styleClass="label" value="#{msg.username}" />
          <h:inputText id="username" styleClass="value" value="#{loginController.username}" required="true">
            <t:validateRegExpr pattern="\w+" summaryMessage="#{msg.illegal_username}" />
            <f:attribute name="name" value="username" />
          </h:inputText>
          <t:div styleClass="spacer">&nbsp;</t:div>
        </t:div>
        <t:div styleClass="formRow">
          <h:outputLabel id="passwordLabel" for="password" styleClass="label" value="#{msg.password}" />
          <h:inputSecret id="password" styleClass="value" value="#{loginController.passWord}" required="true">
            <t:validateRegExpr pattern="\S+" summaryMessage="#{msg.illegal_password}" />
            <f:attribute name="name" value="password" />
          </h:inputSecret>
          <t:div styleClass="spacer">&nbsp;</t:div>
        </t:div>


The javascript is still created the same way, so maybe this bug belongs to the MyFaces core project.

Cheers,
Bas Velthuizen

> Javascript for input elements is wrong
> --------------------------------------
>
>                 Key: TOMAHAWK-1292
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1292
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>    Affects Versions: 1.1.6
>         Environment: Java JDK 5.0, Tomcat 6.0 MyFaces 1.1.5, Tomahawk 1.1.6
>            Reporter: Bas Velthuizen
>
> I've created a simple login-page with a username and password and a submit-button (see code below)
>     <h:form id="loginForm">
>       <t:div id="login" forceId="true">
>         <t:div id="errorMessages">
>           <t:messages id="messages" showSummary="true" showDetail="false" layout="list" />
>         </t:div>
>         <t:div styleClass="formRow">
>           <h:outputLabel id="usernameLabel" for="username" styleClass="label" value="#{msg.username}" />
>           <t:inputText id="username" styleClass="value" value="#{loginController.username}" required="true" forceId="true">
>             <t:validateRegExpr pattern="\w+" summaryMessage="#{msg.illegal_username}" />
>             <f:attribute name="name" value="username" />
>           </t:inputText>
>           <t:div styleClass="spacer">&nbsp;</t:div>
>         </t:div>
>         <t:div styleClass="formRow">
>           <h:outputLabel id="passwordLabel" for="password" styleClass="label" value="#{msg.password}" />
>           <t:inputSecret id="password" styleClass="value" value="#{loginController.passWord}" required="true" forceId="true">
>             <t:validateRegExpr pattern="\S+" summaryMessage="#{msg.illegal_password}" />
>             <f:attribute name="name" value="password" />
>           </t:inputSecret>
>           <t:div styleClass="spacer">&nbsp;</t:div>
>         </t:div>
>         <t:div styleClass="commands">
>           <t:commandButton id="submit" action="#{loginController.doLogin}" value="#{msg.submit}" />
>         </t:div>
>       </t:div>
>     </h:form>
> When this code is rendered in myfaces, a javascript-function is generated that looks like the following:
> <script type="text/javascript" >
> 	 tomahawk.createView = function(facesContext) {
> 		 facesContext.clearMessages();
> 		 facesContext.viewRoot = new tomahawk.UIViewRoot();
> 		 facesContext.viewRoot.addChild((new tomahawk.UIInput('username','username',true,null,new Array(new null ) ) ) );
> 		 facesContext.viewRoot.addChild((new tomahawk.UIInput('password','password',true,null,new Array(new null ) ) ) );
> 	 }
> 	 tomahawk.renderResponse = function(facesContext) {
> 		 var uimessages = new tomahawk.UIMessages('loginForm:messages','list',true,false);
> 		 tomahawk.RendererUtils.renderMessages(facesContext,uimessages); 
> 		 viewRoot = facesContext.viewRoot;
> 		 for(var i = 0; i < viewRoot.children.length ; i ++) { 
> 				  var uiinput = viewRoot.children[i]; 
> 				 tomahawk.RendererUtils.renderMessage(facesContext,uiinput.clientId); 
> 			 }
> 		 }
> </script>
> In the tomahawk.createView function, two UIInput elements are created, with at the end of the paramer list (I believe something with a validator list): 
> new Array(new null )
> This generates a javascript error when the form is submitted, in firefox3 als well as in IE7.
> The form is working, but I don't know what the real effects are of this bug, except an inappropriate error dialog in IE.

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