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

Validation question

 
seb petterson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to validate a form so that it's valid if the user entered something into at least one field out of two. Is there a standard way to do this with validators in JSF, or should I just take care of this in the backing bean?

Seb
 
Aditya Tallapally
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use javascript or backing beans as you said.
I prefer doing it using javascript, add implementation to form button.

Guys correct me if i am wrong.
 
seb petterson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Aditya Tallapally:
You could use javascript or backing beans as you said.
I prefer doing it using javascript, add implementation to form button.

Guys correct me if i am wrong.


Ok. I would think I prefer the backing bean solution since it eliminates the possibility of the user disabling the javascript restriction and posting the illegal form content anyway.

Thanks.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would go for both. Javascript for user's convenience, server-side for reliablity.

Cheers.
 
seb petterson
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Adeel Ansari:
I would go for both. Javascript for user's convenience, server-side for reliablity.

Cheers.


agree
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic