myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graeme Steyn (JIRA)" <...@myfaces.apache.org>
Subject [jira] Created: (TRINIDAD-123) Client side validation: <tr:selectOneRadio>
Date Wed, 25 Jul 2007 10:42:32 GMT
Client side validation: <tr:selectOneRadio>
-------------------------------------------

                 Key: TRINIDAD-123
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-123
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 1.2.1-core
         Environment: Facelets 1.1.12 or JSP 2.1; SUn Java System Application Server 9.0 Ur
1 Patch 03; JDK 1.6.0_01; JSF RI 1.2_04-b16-p02
            Reporter: Graeme Steyn
            Priority: Minor


Clientside validation does not work for the tr:selectOneRadio component. If the component
is marked as required and no selection is made, then you do not get an error when attempting
to navigate to the next page. No validation message occurs and as the post back is aborted
due to the JavaScript error. There is no visual indication for the problem other than simple
remaining on the same page when clicking the next button. The problem is reproducable using
the following jspx: 

<?xml version='1.0' encoding='windows-1252'?> <jsp:root
xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:tr="http://myfaces.apache.org/trinidad"
          xmlns:trh="http://myfaces.apache.org/trinidad/html">
  <jsp:output omit-xml-declaration="true" doctype-root-element="html"
 
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
              doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"/>
  <jsp:directive.page contentType="text/html;charset=windows-1252"/>
  <f:view>
    <trh:html>
      <trh:head title="Dialog">
        <meta http-equiv="Content-Type"
              content="text/html; charset=windows-1252"/>
      </trh:head>
      <trh:body>
        <tr:form>
          <tr:panelFormLayout>

      	    <tr:selectOneRadio
              id="effort"
              layout="vertical"
              label="Test"
              required="true">
              <tr:selectItem 
                value="true" 
                label="Yes" />
              <tr:selectItem 
                value="false" 
                label="No" />
            </tr:selectOneRadio>

          </tr:panelFormLayout>

          <tr:panelButtonBar id="pageNav">
            <tr:commandButton
              action="continue"
              text="continue" />
          </tr:panelButtonBar>

        </tr:form>
      </trh:body>
    </trh:html>
  </f:view>
</jsp:root> 

Issue appears to be related to the function _multiValidate in common-1.2.1.js.  In particular,
the ID for the radio button does not appear to be set correctly in the failureArray.  In the
code below value ="" and on 4743 currInput.id is undefined.  The required error string in
4744 is however, correct.  Later manipulate of the error message then fails as the id does
not match "undefined".  This is based on initial observation using FireBug and could well
be wrong.

4734  var value=_getValue(currInput);
4735  var required=validators[i+1];
4736  if(required&&((value=="")||(value==null)))
4737  {
4738  requiredFormatIndex=validators[i+2];
4739  var requiredErrorString=_getErrorString(currInput,
4740  requiredFormatIndex);
4741  if(requiredErrorString)
4742  {
4743  failureArray[failureArray.length]=currInput.id;
4744  failureArray[failureArray.length]=requiredErrorString;
4745  requiredErrorString=_getGlobalErrorString(currInput,
4746  globalMessageIndex,
4747  requiredErrorString,
4748  label);
4749  failures+='\n'+requiredErrorString;
4750  }

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


Mime
View raw message