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"> </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"> </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.