myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Steiner <matthias.aget...@siag.it>
Subject Re: t:dataTable: how to change css-style on single cells after conversion error?
Date Fri, 31 Aug 2007 06:23:20 GMT

I can't change to Seam anymore.
Didn't anyone face the same problem with MyFaces? 



Andrew Robinson-5 wrote:
> 
> If you want to use Seam they have the ability to wrap components with
> messages:
> 
> http://docs.jboss.org/seam/1.2.1.GA/reference/en/html_single/#validation
> 
> On 8/30/07, Peter Steiner <matthias.agethle@siag.it> wrote:
>>
>> I have a t:dataTable where users can input numbers (a worksheet like in
>> excel).
>> I wrote a custom converter in order to convert the Strings to a Number.
>> If
>> the format is not the one I expect I would like to change the
>> css-styleClass
>> of the cell(s) with wrong input so the user can see quickly in which cell
>> the error happened (and additionally I print an error-message on top of
>> the
>> screen).
>>
>>       <t:dataTable var="row" value="#{Bean.list}" >
>>         <t:column>
>>                 <t:inputText value="#{row.value}" converter="myConverter"
>>                          styleClass="#{StyleBean.style]}" />
>>         </t:column>
>>               ...
>>        </t:dataTable>
>>
>> My converter works, but I don't know how to change the style of the
>> input-component. The following code does not work, it changes me the
>> error
>> class of the whole column!
>>
>>         public Double getAsObject(FacesContext fc, UIComponent uc, String
>> asString)
>>                         throws ConverterException {
>>
>>                 Double doubleValue = null;
>>                 try {
>>                                   ..... //convert the string to a double
>>                 } catch (Exception e) {
>>
>> ((HtmlInputText)uc).setStyleClass("errorStyle");
>>                                        FacesMessage facesMessage = ....
>>                         throw new ConverterException(facesMessage);
>>                 }
>>                 return doubleValue;
>>         }
>>
>> Does anyone know how I can solve this problem?
>> Any help is appreciated.
>>
>> Many Thanks
>> Peter
>> --
>> View this message in context:
>> http://www.nabble.com/t%3AdataTable%3A-how-to-change-css-style-on-single-cells-after-conversion-error--tf4355282.html#a12410633
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/t%3AdataTable%3A-how-to-change-css-style-on-single-cells-after-conversion-error--tf4355282.html#a12421299
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message