This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JSF and the fly likes JSF validation issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "JSF validation issue " Watch "JSF validation issue " New topic

JSF validation issue

hemant joshi

Joined: Sep 21, 2011
Posts: 1
1)We are using JSF 2.0 datatable , at each row of datatable we are performing crud operations.For that we are doing validating for each row .There is a EDIT button for each row ,so when clicked on three row's EDIT button and we get two buttons SAVE and CANCEL .Now when we are saving empty single out of three empty rows ,validation message is coming for all the three rows.

2)for <f:ajax> tag execute=@id is not working for me ...

Please find the below code :

<h:dataTable value="#{manage.manageList}"
var="manage1" styleClass="TableBorder" cellspacing="0"
cellpadding="0" headerClass="category-table-header"
rowClasses="Whiterow,Greyrow" style="width: 610px; margin-top:0px; height:auto" columnClasses="Column130L,Column90,Column70,Column110,Column90">
<h:messages id="messages" />
<h:column styleClass="TableTxt">
<h:inputText value="#{manage1.manageName}" size="10" style="margin-left:40px;"
id="manageName" rendered="#{!manage1.readOnly}"
requiredMessage="#{msg.msg_Name_required}" styleClass="TableInput">

<hutputText value="#{manage1.manageName}"
rendered="#{manage1.readOnly}" />
<h:column style="align:center;">
<h:inputText value="#{manage1.months}" id="months" size="10"
rendered="#{!manage1.readOnly and manage1.planCount==0}"
required="true" requiredMessage="#{msg.msg_months_required}"
validatorMessage="#{msg.msg_months_validate}" styleClass="TableInput">
<f:validateLongRange minimum="1" maximum="999"/>
<hutputText value="#{manage1.months}"
rendered="#{!manage1.readOnly and manage1.planCount>0}" />
<hutputText value="#{manage1.months}"
rendered="#{manage1.readOnly and manage1.months!=0}" />
<h:column style="align:center;">
<h:inputText value="#{manage1.years}" id="years" size="10"
required="true" requiredMessage="#{msg.msg_years_required}"
validatorMessage="#{msg.msg_years_validate}" styleClass="TableInput">
<f:validateLongRange minimum="1" maximum="999999" />
<hutputText value="#{manage1.years}"
rendered="#{!manage1.readOnly}" />
<hutputText value="#{manage1.years}"
rendered="#{manage1.readOnly and manage1.years!=0}" />

<h:column style="align:center;">
<h:commandButton value="#{msg.label_save}" class="BlueBtn"
<f:ajax execute="@form" render="@form" />
<h:commandButton value="#{msg.label_cancel}" class="BlueBtn"
rendered="#{manage1.showCancelButton}" immediate="true">
<f:ajax execute="@this" render="@form" />
<h:commandLink actionListener="#{manage.editmanage}" rendered="#{manage1.showEditButton}">
<hutputText style="font-weight: bold;"
value="#{msg.label_edit}" />
<f:ajax execute="@form" render="@form" />
<h:commandButton value="#{msg.label_add}" type="submit" class="BlueBtn"
<f:ajax execute="@form" render="@form" />

So anybody can suggest me some better way to do it or any solution fro this issue.

It is sorta covered in the JavaRanch Style Guide.
subject: JSF validation issue
It's not a secret anymore!