Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Server side validation of inputText

 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody ,
I am creating 4 inputText (<h:inputText>) dynamically by using <c:forEach> .
I want to validate each field (each fields should be mandatory ) . I am not able to do it.

Here is my jsf code :



Here is my backing bean code :

I have taken "infoList" as an List<SelectItem>



My problem :
I am not able to print the message in the jsf , because I am not getting the id of inputText .Is there any other way to solve this problem ?

please help .

thanks & regards ,
S
 
Tomasz Lipinski
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Instead of c:forEach use h:dataTable with one h:column. dataTable will automaticaly assign ids like tableId:0:inputId, tableId:1:inputId etc. h:message tags will then correspond to proper inputTexts.
 
Robert Filipczyk
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe try to use:

instead of
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all of you for your's valuable posts
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic