• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF FORM Validation  RSS feed

 
rudresh kumar
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,

I have form built on jsf with 10 input fields (application running on porlet). i am trying to do java script validation for mandatory fields before submit, but i am not able to achieve this.


Can some one help me on this

Thanks in advance
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK for the Form tag, wouldn't you just add a onSubmit="myJavaScript" to it, and in that use the "Dom" object to go through your form's objects?

I am really asking, because I haven't done this before, and if I did that is the approach that I would expect.

Mark
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless using a JSF tag that support client side form validation then yes, you just need to do it manually. Don't forget JSF creates element id's like so:

formName:elementId
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!