You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-user@incubator.apache.org by Graeme Steyn <g....@cqu.edu.au> on 2007/01/17 01:33:53 UTC

tr:SelectOneRadio client side validation problem - JavaScript Error - faces-1_2-070102 branch

Good Morning,
 
I am currently experiencing a problem with the client side validation on
the tr:selectOneRadio component.  The xhtml for this component appears
as follows:
 
        <tr:selectOneRadio
          id="gender"
          layout="vertical"
          label="#{bundle.bioGender}"
          required="true"
          value="#{visit.candidate.gender}"
          disabled="#{formReadOnly}"
          shortDesc="#{bundle.bioGender}">
          <f:selectItems value="#{applicationSelectItems.genderList}" />
        </tr:selectOneRadio>
 
This is wrapped in a tr:form and the body uses the normal xhtml <body>
tag.  The problem is that if this is the first element validated via the
JavaScript when the form is submitted, an error occurs and the
submission process aborts.  No validation message occurs and as no post
back has taken place, no messages etc are rendered.  The user thus gets
no feedback other than a form that fails to submit.  However, if there
are more required components with no values and a tr:selectOneRadio
iteem is not first in the list validated, then the clientside message
appears correctly and lists the tr:selectOneRadio as requiring a value.
Using FireBug in FireFox, the JavaScript stack trace shows the problem
occurring as follows:
 
a0.ownerDocument has no properties       Common11-m7.js (line 4507)
_isShowing                                            Common11-m7.js
(line 4507)
_setFocus                                             Common11-m7.js
(line 4240)
_multiValidate                                        Common11-m7.js
(line 4332)
_personalDataValidator                           personalDetails.x...
(line 234)
_validateForm                                        Common11-m7.js
(line 3484)
submitForm                                           Common11-m7.js
(line 3735)
onclick
personalDetails.x... (line 1)
 
The actual code affect appears as:
 
4505
if(!_agent.isNav&&!_agent.isSafari&&!_agent.isPIE&&!_agent.isBlackBerry)
4506    {
4507    var a2=a0.ownerDocument.defaultView.getComputedStyle(a0,
4508    null);
4509    return((a2["visibility"]!="hidden")&&
4510    (a2["display"]!="none"));
4511}
 
The inspector shows a0 as an array with 2 elements:
    0    -    <input id="gender:_0"> etc
    1    -    <input id="gender:_1"> etc
 
Has anyone else experienced this problem?  Or should I have trh tags or
some other item that could be missing.  I can work around this by using
the following, but this skips the client side validation.


        <tr:panelLabelAndMessage
          for="gender"
          label="#{bundle.bioGender}"
          shortDesc="#{bundle.bioGender}"
          showRequired="true">
       <h:selectOneRadio
          id="gender"
          layout="pageDirection"
          label="#{bundle.bioGender}"
          required="true"
          value="#{visit.candidate.gender}"
          disabled="#{formReadOnly}" >
          <f:selectItems value="#{applicationSelectItems.genderList}" />
        </h:selectOneRadio>
           <tr:message
            for="gender" />
        </tr:panelLabelAndMessage>

Additional information that may be helpful appears as follows:
 
Using: Facelets 1.1.11
          Sun Java System Application Server 9_01 patch 1
          JDK 1.6.0
          JSF 1.2 faces-1_2-070102 branch 
 
Is this a known error or my error ?
 
Thank you.
 
Regards,

Graeme Steyn
Senior Analyst/Programmer
Corporate Information Systems
Information Technology Division
Central Queensland University
Tel: +61 7 4930 9256
Fax: +61 7 4930 6814
E-mail: g.steyn@cqu.edu.au


This e-mail message is intended only for the use of the individual or
entity to which it is addressed and may contain information that is
privileged, confidential and exempt from disclosure under applicable
law. If you are not the intended recipient, any dissemination,
distribution or copying of this communication is strictly prohibited. If
you have received this communication in error, please notify me
immediately by facsimile or telephone. 

 

Re: tr:SelectOneRadio client side validation problem - JavaScript Error - faces-1_2-070102 branch

Posted by Adam Winer <aw...@gmail.com>.
Thanks, looks like a great testcase.  I'll have a look.

-- Adam

On 1/17/07, Graeme Steyn <g....@cqu.edu.au> wrote:
> Thanks Adam,
>
> I have raised JIRA ADFFACES-359.  The jspx to reproduce the error is
> included in the JIRA and appears below.
>
> Regards,
>
> Graeme.
>
> <?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>
>
> -----Original Message-----
> From: Adam Winer [mailto:awiner@gmail.com]
> Sent: Thursday, 18 January 2007 2:27 AM
> To: adffaces-user@incubator.apache.org
> Subject: Re: tr:SelectOneRadio client side validation problem -
> JavaScript Error - faces-1_2-070102 branch
>
> Graeme,
>
> Could you boil this down to the simplest possible page (any attributes
> gone that don't matter, EL changed to hardcoded values, etc.) that still
> reproduces the problem, and post a JIRA with the whole .jspx?
>
> Thanks,
> Adam
>
>
> On 1/16/07, Graeme Steyn <g....@cqu.edu.au> wrote:
> > Good Morning,
> >
> > I am currently experiencing a problem with the client side validation
> > on the tr:selectOneRadio component.  The xhtml for this component
> > appears as follows:
> >
> >         <tr:selectOneRadio
> >           id="gender"
> >           layout="vertical"
> >           label="#{bundle.bioGender}"
> >           required="true"
> >           value="#{visit.candidate.gender}"
> >           disabled="#{formReadOnly}"
> >           shortDesc="#{bundle.bioGender}">
> >           <f:selectItems value="#{applicationSelectItems.genderList}"
> />
> >         </tr:selectOneRadio>
> >
> > This is wrapped in a tr:form and the body uses the normal xhtml <body>
>
> > tag.  The problem is that if this is the first element validated via
> > the JavaScript when the form is submitted, an error occurs and the
> > submission process aborts.  No validation message occurs and as no
> > post back has taken place, no messages etc are rendered.  The user
> > thus gets no feedback other than a form that fails to submit.
> > However, if there are more required components with no values and a
> > tr:selectOneRadio iteem is not first in the list validated, then the
> > clientside message appears correctly and lists the tr:selectOneRadio
> as requiring a value.
> > Using FireBug in FireFox, the JavaScript stack trace shows the problem
>
> > occurring as follows:
> >
> > a0.ownerDocument has no properties       Common11-m7.js (line 4507)
> > _isShowing                                            Common11-m7.js
> > (line 4507)
> > _setFocus                                             Common11-m7.js
> > (line 4240)
> > _multiValidate                                        Common11-m7.js
> > (line 4332)
> > _personalDataValidator                           personalDetails.x...
> > (line 234)
> > _validateForm                                        Common11-m7.js
> > (line 3484)
> > submitForm                                           Common11-m7.js
> > (line 3735)
> > onclick
> > personalDetails.x... (line 1)
> >
> > The actual code affect appears as:
> >
> > 4505
> >
> if(!_agent.isNav&&!_agent.isSafari&&!_agent.isPIE&&!_agent.isBlackBerry)
> > 4506    {
> > 4507    var a2=a0.ownerDocument.defaultView.getComputedStyle(a0,
> > 4508    null);
> > 4509    return((a2["visibility"]!="hidden")&&
> > 4510    (a2["display"]!="none"));
> > 4511}
> >
> > The inspector shows a0 as an array with 2 elements:
> >     0    -    <input id="gender:_0"> etc
> >     1    -    <input id="gender:_1"> etc
> >
> > Has anyone else experienced this problem?  Or should I have trh tags
> > or some other item that could be missing.  I can work around this by
> > using the following, but this skips the client side validation.
> >
> >
> >         <tr:panelLabelAndMessage
> >           for="gender"
> >           label="#{bundle.bioGender}"
> >           shortDesc="#{bundle.bioGender}"
> >           showRequired="true">
> >        <h:selectOneRadio
> >           id="gender"
> >           layout="pageDirection"
> >           label="#{bundle.bioGender}"
> >           required="true"
> >           value="#{visit.candidate.gender}"
> >           disabled="#{formReadOnly}" >
> >           <f:selectItems value="#{applicationSelectItems.genderList}"
> />
> >         </h:selectOneRadio>
> >            <tr:message
> >             for="gender" />
> >         </tr:panelLabelAndMessage>
> >
> > Additional information that may be helpful appears as follows:
> >
> > Using: Facelets 1.1.11
> >           Sun Java System Application Server 9_01 patch 1
> >           JDK 1.6.0
> >           JSF 1.2 faces-1_2-070102 branch
> >
> > Is this a known error or my error ?
> >
> > Thank you.
> >
> > Regards,
> >
> > Graeme Steyn
> > Senior Analyst/Programmer
> > Corporate Information Systems
> > Information Technology Division
> > Central Queensland University
> > Tel: +61 7 4930 9256
> > Fax: +61 7 4930 6814
> > E-mail: g.steyn@cqu.edu.au
> >
> >
> > This e-mail message is intended only for the use of the individual or
> > entity to which it is addressed and may contain information that is
> > privileged, confidential and exempt from disclosure under applicable
> > law. If you are not the intended recipient, any dissemination,
> > distribution or copying of this communication is strictly prohibited.
> > If you have received this communication in error, please notify me
> > immediately by facsimile or telephone.
> >
> >
> >
> >
>

RE: tr:SelectOneRadio client side validation problem - JavaScript Error - faces-1_2-070102 branch

Posted by Graeme Steyn <g....@cqu.edu.au>.
Thanks Adam,

I have raised JIRA ADFFACES-359.  The jspx to reproduce the error is
included in the JIRA and appears below.

Regards,

Graeme.

<?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> 

-----Original Message-----
From: Adam Winer [mailto:awiner@gmail.com] 
Sent: Thursday, 18 January 2007 2:27 AM
To: adffaces-user@incubator.apache.org
Subject: Re: tr:SelectOneRadio client side validation problem -
JavaScript Error - faces-1_2-070102 branch

Graeme,

Could you boil this down to the simplest possible page (any attributes
gone that don't matter, EL changed to hardcoded values, etc.) that still
reproduces the problem, and post a JIRA with the whole .jspx?

Thanks,
Adam


On 1/16/07, Graeme Steyn <g....@cqu.edu.au> wrote:
> Good Morning,
>
> I am currently experiencing a problem with the client side validation 
> on the tr:selectOneRadio component.  The xhtml for this component 
> appears as follows:
>
>         <tr:selectOneRadio
>           id="gender"
>           layout="vertical"
>           label="#{bundle.bioGender}"
>           required="true"
>           value="#{visit.candidate.gender}"
>           disabled="#{formReadOnly}"
>           shortDesc="#{bundle.bioGender}">
>           <f:selectItems value="#{applicationSelectItems.genderList}"
/>
>         </tr:selectOneRadio>
>
> This is wrapped in a tr:form and the body uses the normal xhtml <body>

> tag.  The problem is that if this is the first element validated via 
> the JavaScript when the form is submitted, an error occurs and the 
> submission process aborts.  No validation message occurs and as no 
> post back has taken place, no messages etc are rendered.  The user 
> thus gets no feedback other than a form that fails to submit.  
> However, if there are more required components with no values and a 
> tr:selectOneRadio iteem is not first in the list validated, then the 
> clientside message appears correctly and lists the tr:selectOneRadio
as requiring a value.
> Using FireBug in FireFox, the JavaScript stack trace shows the problem

> occurring as follows:
>
> a0.ownerDocument has no properties       Common11-m7.js (line 4507)
> _isShowing                                            Common11-m7.js
> (line 4507)
> _setFocus                                             Common11-m7.js
> (line 4240)
> _multiValidate                                        Common11-m7.js
> (line 4332)
> _personalDataValidator                           personalDetails.x...
> (line 234)
> _validateForm                                        Common11-m7.js
> (line 3484)
> submitForm                                           Common11-m7.js
> (line 3735)
> onclick
> personalDetails.x... (line 1)
>
> The actual code affect appears as:
>
> 4505
>
if(!_agent.isNav&&!_agent.isSafari&&!_agent.isPIE&&!_agent.isBlackBerry)
> 4506    {
> 4507    var a2=a0.ownerDocument.defaultView.getComputedStyle(a0,
> 4508    null);
> 4509    return((a2["visibility"]!="hidden")&&
> 4510    (a2["display"]!="none"));
> 4511}
>
> The inspector shows a0 as an array with 2 elements:
>     0    -    <input id="gender:_0"> etc
>     1    -    <input id="gender:_1"> etc
>
> Has anyone else experienced this problem?  Or should I have trh tags 
> or some other item that could be missing.  I can work around this by 
> using the following, but this skips the client side validation.
>
>
>         <tr:panelLabelAndMessage
>           for="gender"
>           label="#{bundle.bioGender}"
>           shortDesc="#{bundle.bioGender}"
>           showRequired="true">
>        <h:selectOneRadio
>           id="gender"
>           layout="pageDirection"
>           label="#{bundle.bioGender}"
>           required="true"
>           value="#{visit.candidate.gender}"
>           disabled="#{formReadOnly}" >
>           <f:selectItems value="#{applicationSelectItems.genderList}"
/>
>         </h:selectOneRadio>
>            <tr:message
>             for="gender" />
>         </tr:panelLabelAndMessage>
>
> Additional information that may be helpful appears as follows:
>
> Using: Facelets 1.1.11
>           Sun Java System Application Server 9_01 patch 1
>           JDK 1.6.0
>           JSF 1.2 faces-1_2-070102 branch
>
> Is this a known error or my error ?
>
> Thank you.
>
> Regards,
>
> Graeme Steyn
> Senior Analyst/Programmer
> Corporate Information Systems
> Information Technology Division
> Central Queensland University
> Tel: +61 7 4930 9256
> Fax: +61 7 4930 6814
> E-mail: g.steyn@cqu.edu.au
>
>
> This e-mail message is intended only for the use of the individual or 
> entity to which it is addressed and may contain information that is 
> privileged, confidential and exempt from disclosure under applicable 
> law. If you are not the intended recipient, any dissemination, 
> distribution or copying of this communication is strictly prohibited. 
> If you have received this communication in error, please notify me 
> immediately by facsimile or telephone.
>
>
>
>

Re: tr:SelectOneRadio client side validation problem - JavaScript Error - faces-1_2-070102 branch

Posted by Adam Winer <aw...@gmail.com>.
Graeme,

Could you boil this down to the simplest possible page
(any attributes gone that don't matter, EL changed
to hardcoded values, etc.) that still reproduces
the problem, and post a JIRA with the whole .jspx?

Thanks,
Adam


On 1/16/07, Graeme Steyn <g....@cqu.edu.au> wrote:
> Good Morning,
>
> I am currently experiencing a problem with the client side validation on
> the tr:selectOneRadio component.  The xhtml for this component appears
> as follows:
>
>         <tr:selectOneRadio
>           id="gender"
>           layout="vertical"
>           label="#{bundle.bioGender}"
>           required="true"
>           value="#{visit.candidate.gender}"
>           disabled="#{formReadOnly}"
>           shortDesc="#{bundle.bioGender}">
>           <f:selectItems value="#{applicationSelectItems.genderList}" />
>         </tr:selectOneRadio>
>
> This is wrapped in a tr:form and the body uses the normal xhtml <body>
> tag.  The problem is that if this is the first element validated via the
> JavaScript when the form is submitted, an error occurs and the
> submission process aborts.  No validation message occurs and as no post
> back has taken place, no messages etc are rendered.  The user thus gets
> no feedback other than a form that fails to submit.  However, if there
> are more required components with no values and a tr:selectOneRadio
> iteem is not first in the list validated, then the clientside message
> appears correctly and lists the tr:selectOneRadio as requiring a value.
> Using FireBug in FireFox, the JavaScript stack trace shows the problem
> occurring as follows:
>
> a0.ownerDocument has no properties       Common11-m7.js (line 4507)
> _isShowing                                            Common11-m7.js
> (line 4507)
> _setFocus                                             Common11-m7.js
> (line 4240)
> _multiValidate                                        Common11-m7.js
> (line 4332)
> _personalDataValidator                           personalDetails.x...
> (line 234)
> _validateForm                                        Common11-m7.js
> (line 3484)
> submitForm                                           Common11-m7.js
> (line 3735)
> onclick
> personalDetails.x... (line 1)
>
> The actual code affect appears as:
>
> 4505
> if(!_agent.isNav&&!_agent.isSafari&&!_agent.isPIE&&!_agent.isBlackBerry)
> 4506    {
> 4507    var a2=a0.ownerDocument.defaultView.getComputedStyle(a0,
> 4508    null);
> 4509    return((a2["visibility"]!="hidden")&&
> 4510    (a2["display"]!="none"));
> 4511}
>
> The inspector shows a0 as an array with 2 elements:
>     0    -    <input id="gender:_0"> etc
>     1    -    <input id="gender:_1"> etc
>
> Has anyone else experienced this problem?  Or should I have trh tags or
> some other item that could be missing.  I can work around this by using
> the following, but this skips the client side validation.
>
>
>         <tr:panelLabelAndMessage
>           for="gender"
>           label="#{bundle.bioGender}"
>           shortDesc="#{bundle.bioGender}"
>           showRequired="true">
>        <h:selectOneRadio
>           id="gender"
>           layout="pageDirection"
>           label="#{bundle.bioGender}"
>           required="true"
>           value="#{visit.candidate.gender}"
>           disabled="#{formReadOnly}" >
>           <f:selectItems value="#{applicationSelectItems.genderList}" />
>         </h:selectOneRadio>
>            <tr:message
>             for="gender" />
>         </tr:panelLabelAndMessage>
>
> Additional information that may be helpful appears as follows:
>
> Using: Facelets 1.1.11
>           Sun Java System Application Server 9_01 patch 1
>           JDK 1.6.0
>           JSF 1.2 faces-1_2-070102 branch
>
> Is this a known error or my error ?
>
> Thank you.
>
> Regards,
>
> Graeme Steyn
> Senior Analyst/Programmer
> Corporate Information Systems
> Information Technology Division
> Central Queensland University
> Tel: +61 7 4930 9256
> Fax: +61 7 4930 6814
> E-mail: g.steyn@cqu.edu.au
>
>
> This e-mail message is intended only for the use of the individual or
> entity to which it is addressed and may contain information that is
> privileged, confidential and exempt from disclosure under applicable
> law. If you are not the intended recipient, any dissemination,
> distribution or copying of this communication is strictly prohibited. If
> you have received this communication in error, please notify me
> immediately by facsimile or telephone.
>
>
>
>