Thanks for experiments. This seems a bug/defect. User need to know which row got a problem in a dataTable.

Frode Oldervoll <[EMAIL PROTECTED]> wrote:

Assigning an id to fields inside a dataTable should work; they still are unique per row since the dataTable index is included in the actual id. The error messages still does not seem to work, however. This looks like a bug to me.

 

Here is an example. I have this form with a dataTable inside, which again contains a set of outputLabel/inputText pairs.

 

<h:form id="testForm">

      <t:messages/>

      <t:dataTable id="testTable">

            <h:column>

                  <h:outputLabel for="" value="Test label"/>

                  <h:inputText required="true" id="testField"/>

            </h:column>

      </t:dataTable>

</h:form>

 

If we look at the actual HTML code generated for a couple of rows, then we see:

 

<label for="">Test label</label>

<input id=" testForm:testTable_0:testField"

       name=" testForm:testTable_0:testField"

       type="text" value=""/>

<label for="">Test label</label>

<input id=" testForm:testTable_1:testField"

       name=" testForm:testTable_1:testField"

       type="text" value=""/>

 

Even if the ids in the label and the input field matches I still get the message ¡°Validation Error in testField¡± instead of ¡°Validation error in Test label¡±.

 

-Frode

 

 


From: Dave [mailto:[EMAIL PROTECTED]
Sent: 14. oktober 2005 02:52
To: MyFaces Discussion
Subject: Re: dataTable error message - Validation Error "_id49": Value is not a valid option.

 

I tried outputLabel, but it still did not work.

 

<t:dataTable

           var="student"

           value="#{bean.students}">

    <h:column>

         <h:outputLabel for="" value="#{student.name}"/>

    </h:column>

    <h:column>

         <h:inputText id="score" value="#{student.score}"/>

    </h:column>

</t:dataTable>


 

All the validation error messages are using the same id "score".  when I tried to use student name as id,

 

<t:dataTable

           var="student"

           value="#{bean.students}">

    <h:column>

         <h:outputLabel for="" value="#{student.name}"/>

    </h:column>

    <h:column>

         <h:inputText id="#{student.name}" value="#{student.score}"/>

    </h:column>

</t:dataTable>

 

I got error message: id must start with letter/digit/_. Obviously id must be a constant and  can not be method binding. Any ideas appreciated. thanks.

 


Mike Kienenberger <[EMAIL PROTECTED]> wrote:

Yes, that's why I suggested you'd be better off trying to use a label
and have the value bound to your row data instead. But I haven't
tried it.

Remember that components in your dataTable may represent multiple
rows, but every row is still represented by only one component. So
only by binding something to your backing data will you get different
behavior per row.

On 10/13/05, Dave <[EMAIL PROTECTED]>wrote:
> This approach works fine if data are not in .
> For dataTable, we have a collection of data.
> Suppose the collection have ten rows. All of them will have the same id(s).
> If there is a validation error, user will not be able to know which row has
> the error.
>
> ---------
>
>
>
>
> Mike Kienenberger <[EMAIL PROTECTED]>wrote:
> I'd probably go with a label instead, but you could just use
>
>
>
>
> On 10/13/05, Dave wrote:
> > what id should I assign to them statically? The data model is a list of
> > objects. Thanks.
> >
> > > var="student"
> > value="#{bean.students}">
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > Mike Kienenberger wrote:
> > You can statically assign an id on your page.
> >
> > I think y ou can also assign a label to your component, and that label
> > value will be used instead of the id.
> >
> > On 10/13/05, Dave wrote:
> > >
> > > Hello,
> > > I am using with two columns.
> > & gt; one is label, the other is .
> > > If there is any validation problem, I get the message like:
> > >
> > >
> > > Validation Error "_id49": Value is not a valid option.
> > >
> > >
> > >
> > > How can I replace _id49 with some meaningful id?
> > >
> > > I notieced that component id can not bind to backing bean(or data model)
> > > method.
> > >
> > >
> > >
> > > Thanks. Dave
> > >
> > > ________________________________
> > > Yahoo! Music Unlimited - Access over 1 million songs. Try it free.
> > >
> > >
> >
> >
> > ________________________________
> > Yahoo! Music Unlimited - Access over 1 million s ongs. Try it free.
> >
> >
>
>
> ________________________________
> Ya hoo! Music Unlimite d - Access over 1 million songs. Try it free.
>
>


Yahoo! Music Unlimited - Access over 1 million songs. Try it free.


Yahoo! Music Unlimited - Access over 1 million songs. Try it free.

Reply via email to