• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF validation issue

 
hemant joshi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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}"
required="true"
requiredMessage="#{msg.msg_Name_required}" styleClass="TableInput">

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


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

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


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic