You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Frode Oldervoll <Fr...@7m.com> on 2005/10/12 10:19:45 UTC
t:messages: label inside t:dataTable not expanded for validation messages
I cannot get validation messages to work properly for fields inside a data
table.
The following scenario works:
-----------------------------
<h:form id="testForm">
<t:messages/>
<h:outputLabel for="testField" value="Test label"/>
<h:inputText required="true" id="testField"/>
</h:form>
If I submit an empty value here, then I get the error message I expected:
"Validation Error in Test label".
The HTML code for the outputLabel/inputText pair looks like this:
<label for="testForm:testField">Test label</label>
<input id="testForm:testField"
name="testForm:testField"
type="text" value=""/>
The following scenario does NOT work:
-------------------------------------
<h:form id="testForm">
<t:messages/>
<t:dataTable id="testTable">
<h:outputLabel for="testField" value="Test label"/>
<h:inputText required="true" id="testField"/>
</t:dataTable>
</h:form>
If I submit an empty value here, then I get this error message, where the
testField id is not expanded to the label value:
"Validation Error in testField".
The HTML code for the outputLabel/inputText pair now looks like this:
<label for="testForm:testTable_0:testField">Test label</label>
<input id=" testForm:testTable_0:testField"
name=" testForm:testTable_0:testField"
type="text" value=""/>
Am I doing anything wrong here, or is this a bug?
-Frode Oldervoll
RE: t:messages: label inside t:dataTable not expanded for validation messages
Posted by Frode Oldervoll <Fr...@7m.com>.
Using a header facet will not give me the behavior I want - I will then get
the same value for every row, and I need a separate value for each row in
the table.
I have reported this as a bug against both MyFaces 1.1.0 and 1.1.1-rc3 -
MYFACES-735.
(I think I have narrowed the problem down to
org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer.findInputLabel -
the IDs inside the table do not seem to be included in the outputLabelMap. I
have not yet figured out why they are not there, however).
Best Regards
Frode Oldervoll
> -----Original Message-----
> From: Martin Marinschek [mailto:martin.marinschek@gmail.com]
> Sent: 17. oktober 2005 14:04
> To: MyFaces Discussion
> Subject: Re: t:messages: label inside t:dataTable not expanded for
> validation messages
>
> Try this:
>
> <h:form id="testForm">
> <t:messages/>
> <t:dataTable id="testTable">
> <h:column>
> <f:facet name="header">
> <h:outputText value="Test label"/>
> </f:facet>
> <h:inputText required="true" id="testField"/>
> </h:column>
> </t:dataTable>
> </h:form>
>
> This is MyFaces specific behaviour though!
>
> regards,
>
> Martin
>
> On 10/13/05, Frode Oldervoll <Fr...@7m.com> wrote:
> > I just forgot to add the columns in my example, the code I run uses
> columns,
> > like this:
> >
> > <h:form id="testForm">
> > <t:messages/>
> > <t:dataTable id="testTable">
> > <h:column>
> > <h:outputLabel for="testField" value="Test label"/>
> > <h:inputText required="true" id="testField"/>
> > </h:column>
> > </t:dataTable>
> > </h:form>
> >
> > So I guess this is a bug then. I'll try to track down the problem.
> >
> > -Frode
> >
> > > -----Original Message-----
> > > From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> > > Sent: 12. oktober 2005 19:41
> > > To: MyFaces Discussion
> > > Subject: Re: t:messages: label inside t:dataTable not expanded for
> > > validation messages
> > >
> > > Are you putting testForm:testTable_0:testField and related components
> > > inside a column component? (or did you just leave that part out to
> > > keep the example simple?)
> > >
> > > If you're not putting them in a column, try that first :)
> > >
> > > If you are putting them in a column, it kinda sounds like a bug to me.
> > > Open a Jira issue, and optionally track down the exact problem and
> > > provide a patch.
> > >
> > > Components inside and outside of a dataTable shouldn't behave
> differently.
> > >
> > > On 10/12/05, Frode Oldervoll <Fr...@7m.com> wrote:
> > > > I cannot get validation messages to work properly for fields inside
> a
> > > data
> > > > table.
> > > >
> > > > The following scenario works:
> > > > -----------------------------
> > > >
> > > > <h:form id="testForm">
> > > > <t:messages/>
> > > > <h:outputLabel for="testField" value="Test label"/>
> > > > <h:inputText required="true" id="testField"/>
> > > > </h:form>
> > > >
> > > > If I submit an empty value here, then I get the error message I
> > > expected:
> > > > "Validation Error in Test label".
> > > >
> > > > The HTML code for the outputLabel/inputText pair looks like this:
> > > >
> > > > <label for="testForm:testField">Test label</label>
> > > > <input id="testForm:testField"
> > > > name="testForm:testField"
> > > > type="text" value=""/>
> > > >
> > > >
> > > > The following scenario does NOT work:
> > > > -------------------------------------
> > > >
> > > > <h:form id="testForm">
> > > > <t:messages/>
> > > > <t:dataTable id="testTable">
> > > > <h:outputLabel for="testField" value="Test label"/>
> > > > <h:inputText required="true" id="testField"/>
> > > > </t:dataTable>
> > > > </h:form>
> > > >
> > > > If I submit an empty value here, then I get this error message,
> where
> > > the
> > > > testField id is not expanded to the label value:
> > > > "Validation Error in testField".
> > > >
> > > > The HTML code for the outputLabel/inputText pair now looks like
> this:
> > > >
> > > > <label for="testForm:testTable_0:testField">Test label</label>
> > > > <input id=" testForm:testTable_0:testField"
> > > > name=" testForm:testTable_0:testField"
> > > > type="text" value=""/>
> > > >
> > > >
> > > > Am I doing anything wrong here, or is this a bug?
> > > >
> > > > -Frode Oldervoll
> > > >
> > > >
> > > >
> >
> >
> >
> >
>
>
> --
>
> http://www.irian.at
> Your JSF powerhouse -
> JSF Trainings in English and German
Re: t:messages: label inside t:dataTable not expanded for validation messages
Posted by Martin Marinschek <ma...@gmail.com>.
Try this:
<h:form id="testForm">
<t:messages/>
<t:dataTable id="testTable">
<h:column>
<f:facet name="header">
<h:outputText value="Test label"/>
</f:facet>
<h:inputText required="true" id="testField"/>
</h:column>
</t:dataTable>
</h:form>
This is MyFaces specific behaviour though!
regards,
Martin
On 10/13/05, Frode Oldervoll <Fr...@7m.com> wrote:
> I just forgot to add the columns in my example, the code I run uses columns,
> like this:
>
> <h:form id="testForm">
> <t:messages/>
> <t:dataTable id="testTable">
> <h:column>
> <h:outputLabel for="testField" value="Test label"/>
> <h:inputText required="true" id="testField"/>
> </h:column>
> </t:dataTable>
> </h:form>
>
> So I guess this is a bug then. I'll try to track down the problem.
>
> -Frode
>
> > -----Original Message-----
> > From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> > Sent: 12. oktober 2005 19:41
> > To: MyFaces Discussion
> > Subject: Re: t:messages: label inside t:dataTable not expanded for
> > validation messages
> >
> > Are you putting testForm:testTable_0:testField and related components
> > inside a column component? (or did you just leave that part out to
> > keep the example simple?)
> >
> > If you're not putting them in a column, try that first :)
> >
> > If you are putting them in a column, it kinda sounds like a bug to me.
> > Open a Jira issue, and optionally track down the exact problem and
> > provide a patch.
> >
> > Components inside and outside of a dataTable shouldn't behave differently.
> >
> > On 10/12/05, Frode Oldervoll <Fr...@7m.com> wrote:
> > > I cannot get validation messages to work properly for fields inside a
> > data
> > > table.
> > >
> > > The following scenario works:
> > > -----------------------------
> > >
> > > <h:form id="testForm">
> > > <t:messages/>
> > > <h:outputLabel for="testField" value="Test label"/>
> > > <h:inputText required="true" id="testField"/>
> > > </h:form>
> > >
> > > If I submit an empty value here, then I get the error message I
> > expected:
> > > "Validation Error in Test label".
> > >
> > > The HTML code for the outputLabel/inputText pair looks like this:
> > >
> > > <label for="testForm:testField">Test label</label>
> > > <input id="testForm:testField"
> > > name="testForm:testField"
> > > type="text" value=""/>
> > >
> > >
> > > The following scenario does NOT work:
> > > -------------------------------------
> > >
> > > <h:form id="testForm">
> > > <t:messages/>
> > > <t:dataTable id="testTable">
> > > <h:outputLabel for="testField" value="Test label"/>
> > > <h:inputText required="true" id="testField"/>
> > > </t:dataTable>
> > > </h:form>
> > >
> > > If I submit an empty value here, then I get this error message, where
> > the
> > > testField id is not expanded to the label value:
> > > "Validation Error in testField".
> > >
> > > The HTML code for the outputLabel/inputText pair now looks like this:
> > >
> > > <label for="testForm:testTable_0:testField">Test label</label>
> > > <input id=" testForm:testTable_0:testField"
> > > name=" testForm:testTable_0:testField"
> > > type="text" value=""/>
> > >
> > >
> > > Am I doing anything wrong here, or is this a bug?
> > >
> > > -Frode Oldervoll
> > >
> > >
> > >
>
>
>
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German
RE: t:messages: label inside t:dataTable not expanded for validation messages
Posted by Frode Oldervoll <Fr...@7m.com>.
I just forgot to add the columns in my example, the code I run uses columns,
like this:
<h:form id="testForm">
<t:messages/>
<t:dataTable id="testTable">
<h:column>
<h:outputLabel for="testField" value="Test label"/>
<h:inputText required="true" id="testField"/>
</h:column>
</t:dataTable>
</h:form>
So I guess this is a bug then. I'll try to track down the problem.
-Frode
> -----Original Message-----
> From: Mike Kienenberger [mailto:mkienenb@gmail.com]
> Sent: 12. oktober 2005 19:41
> To: MyFaces Discussion
> Subject: Re: t:messages: label inside t:dataTable not expanded for
> validation messages
>
> Are you putting testForm:testTable_0:testField and related components
> inside a column component? (or did you just leave that part out to
> keep the example simple?)
>
> If you're not putting them in a column, try that first :)
>
> If you are putting them in a column, it kinda sounds like a bug to me.
> Open a Jira issue, and optionally track down the exact problem and
> provide a patch.
>
> Components inside and outside of a dataTable shouldn't behave differently.
>
> On 10/12/05, Frode Oldervoll <Fr...@7m.com> wrote:
> > I cannot get validation messages to work properly for fields inside a
> data
> > table.
> >
> > The following scenario works:
> > -----------------------------
> >
> > <h:form id="testForm">
> > <t:messages/>
> > <h:outputLabel for="testField" value="Test label"/>
> > <h:inputText required="true" id="testField"/>
> > </h:form>
> >
> > If I submit an empty value here, then I get the error message I
> expected:
> > "Validation Error in Test label".
> >
> > The HTML code for the outputLabel/inputText pair looks like this:
> >
> > <label for="testForm:testField">Test label</label>
> > <input id="testForm:testField"
> > name="testForm:testField"
> > type="text" value=""/>
> >
> >
> > The following scenario does NOT work:
> > -------------------------------------
> >
> > <h:form id="testForm">
> > <t:messages/>
> > <t:dataTable id="testTable">
> > <h:outputLabel for="testField" value="Test label"/>
> > <h:inputText required="true" id="testField"/>
> > </t:dataTable>
> > </h:form>
> >
> > If I submit an empty value here, then I get this error message, where
> the
> > testField id is not expanded to the label value:
> > "Validation Error in testField".
> >
> > The HTML code for the outputLabel/inputText pair now looks like this:
> >
> > <label for="testForm:testTable_0:testField">Test label</label>
> > <input id=" testForm:testTable_0:testField"
> > name=" testForm:testTable_0:testField"
> > type="text" value=""/>
> >
> >
> > Am I doing anything wrong here, or is this a bug?
> >
> > -Frode Oldervoll
> >
> >
> >
Re: t:messages: label inside t:dataTable not expanded for validation messages
Posted by Mike Kienenberger <mk...@gmail.com>.
Are you putting testForm:testTable_0:testField and related components
inside a column component? (or did you just leave that part out to
keep the example simple?)
If you're not putting them in a column, try that first :)
If you are putting them in a column, it kinda sounds like a bug to me.
Open a Jira issue, and optionally track down the exact problem and
provide a patch.
Components inside and outside of a dataTable shouldn't behave differently.
On 10/12/05, Frode Oldervoll <Fr...@7m.com> wrote:
> I cannot get validation messages to work properly for fields inside a data
> table.
>
> The following scenario works:
> -----------------------------
>
> <h:form id="testForm">
> <t:messages/>
> <h:outputLabel for="testField" value="Test label"/>
> <h:inputText required="true" id="testField"/>
> </h:form>
>
> If I submit an empty value here, then I get the error message I expected:
> "Validation Error in Test label".
>
> The HTML code for the outputLabel/inputText pair looks like this:
>
> <label for="testForm:testField">Test label</label>
> <input id="testForm:testField"
> name="testForm:testField"
> type="text" value=""/>
>
>
> The following scenario does NOT work:
> -------------------------------------
>
> <h:form id="testForm">
> <t:messages/>
> <t:dataTable id="testTable">
> <h:outputLabel for="testField" value="Test label"/>
> <h:inputText required="true" id="testField"/>
> </t:dataTable>
> </h:form>
>
> If I submit an empty value here, then I get this error message, where the
> testField id is not expanded to the label value:
> "Validation Error in testField".
>
> The HTML code for the outputLabel/inputText pair now looks like this:
>
> <label for="testForm:testTable_0:testField">Test label</label>
> <input id=" testForm:testTable_0:testField"
> name=" testForm:testTable_0:testField"
> type="text" value=""/>
>
>
> Am I doing anything wrong here, or is this a bug?
>
> -Frode Oldervoll
>
>
>