Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can we add restrictions to input text control in JSF  RSS feed

 
suresh dasari
Ranch Hand
Posts: 121
Chrome Eclipse IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

JSF inputtext control will allow alphanumeric values, if we dont want numbers to be entered into text box, we can restrict using javascript.
but is there any way to restrict user from entering numbers into text box?
 
Himalay Majumdar
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may like to use a4j onkeyup/onblur event and do customized validations.
 
Tim Holloway
Bartender
Posts: 18774
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't quite understand this, but you can use the same javascript to block entry of non-numeric characters into a JSF inputText control as you would in a traditional HTML 'input type="text"' control. Even the event attribute name is the same (I think it's onkeyup).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!