Welcome to the IBM Collaboration Solutions Community IQJam
UsernamePassword
Reset Password | Register
   
Home | Tags | Help
textfield formatting 
I would like to do the following:
 
Have a textfield for a field that only allows uppercase letters to be typed.  I know that I can convert to uppercase, but I want to restrict the typing to uppercase in the user's interface.

Additionally, I would like to have a textfield that works in a specific format:

######AAAAAAAA where:
 
# is number only and A is uppercase letter only.

Thanks 
Domino Development / XPages
Tagged
John Coombs - over 3 years ago |  |  | Viewed 190 times

There are 3 answers

1votes
The way to do this would be to write a client side javascript function in one the onKeyDown/onKeyUp/onKeyPress events of the field ... in that function you can do something like this:
 
if(window.event) { // IE
    keynum = e.keyCode
} else if(e.which) {  // Netscape/Firefox/Opera
    keynum = e.which
}
keychar = String.fromCharCode(keynum)
 
then keychar will be the character they entered.  I believe in onKeyDown, you can return false, and it will not record the character, but you'll have to experiment to make sure.
Jeremy Hodge - over 3 years ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community
0votes
If you use thisEvent in the client side script, you could do something like this:
if( !/[A-Z]/.test( thisEvent.keyChar ) ){
   dojo.stopEvent( thisEvent );
}
 
The above code stops the event when the key entered isn't an uppercase letter. 
Tommy Valand - over 2 years ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community
0votes

There's a client side jQuery plugin which lets you set up, and enforce, various input masking options: Masked Input Plugin Perhaps there's a Dojo equivalent?

Ben Poole - over 2 years ago | 
Voting
Vote on the answer to show whether you think the answer is correct or useful to the rest of the community.

Answers with more votes are more visible to the rest of the community

Latest Answers for Domino Development / XPages 

How to call LS agent in xpage
Vijay Kumar - 6 months ago
Multi-values in an xPage view panel column
Judy Kilpinen - 8 months ago
From CSJS refresh a panel dijit.TooltipDialog
daniele grillo - about 1 year ago
How to get value from Repeater Control.
Atul Saxena - about 1 year ago
doing a partial update "beforepageload"
jeroen somhorst - about 1 year ago
How to get value from Repeater Control.
jeroen somhorst - about 1 year ago
How to get value from Repeater Control.
Mervin Thomas - about 1 year ago
Where Would I Delete My Cookie?
Lenni Sauve - over 2 years ago
Query_String value empty with agent URL from xpage
Andy Cunliffe - over 2 years ago
textfield formatting
Ben Poole - over 2 years ago
File Upload/File Download using Managed Beans
Toby Samples - over 2 years ago
File Upload/File Download using Managed Beans
Andy Cunliffe - over 2 years ago

Experts for Domino Development / XPages

There are no experts to display