myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <thomas.a...@mvv.de>
Subject Re: Howto validate t:dataTable input fields
Date Mon, 17 Mar 2008 07:52:32 GMT

Hi Dario,
If the relationship need for validation exists between the checkbox and the value of the label
(or generally any value that can be acquired using an el-Expression) adding an attribute to
the checkbox-component might be the way to do it:

<t:dataTable value="#{lab.datas}" var="varData">
<h:column id="sel">
    <h:selectBooleanCheckbox id="checked1"
        value="#{varData.checked}" >
        <f:attribute name="relation" value="#{varData.person}" />
	</h:selectBooleanCheckbox>


</h:column>

<h:column id="person">
    <h:outputLabel
        value="#{varData.person}" for="checked1"/>
</h:column>
</t:dataTable>

The "relation"-attribute can be accessed using the attributes map from within the Validator:
Map map = component.getAttributes();
String name = (String) map.get("relation");

Using f:attribute, it is possible to attach Objects to Components and Components can be accessed
by their validators.

Hope that helps,
Tom

Thomas Asel 
Diplom Informatiker (FH)
Selbständiger Softwareentwickler
im Auftrag der 24/7 IT-Services GmbH

== == == == == == == == == == == ==
www.thomas-asel.de
J2EE und Contentmanagement-Lösungen
L13,7 68161 Mannheim
Tel.: +49 (0) 621 / 386 448 3
Mobil: +49(0) 176 / 219 284 26
USt-IdNr.: DE248123620





Mime
View raw message