This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Displaying data from right to left in a textbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Displaying data from right to left in a textbox" Watch "Displaying data from right to left in a textbox" New topic
Author

Displaying data from right to left in a textbox

jyoti vij
Greenhorn

Joined: Sep 14, 2007
Posts: 2
Hi,
I need to display data from right to left in a textbox. There should be one fixed decimal point in a textbox and the user is allowed to enter data only to the right and not in the left of decimal. As the user keeps on entering digits the data will be shifting to left of decimal. It should be similar to the scenario of entering amount to be withdrawn from an ATM.
Anirvan Majumdar
Ranch Hand

Joined: Feb 22, 2005
Posts: 261
1 => Use the attribute "dir" with value "rtl" to get your right-to-left direction of text entry in the textbox.
2 => Write a method attached to the event: "onkeyup", which verifies that the user is entering data to the right of the decimal point and also performs the shifting of the digits as is the case in an ATM m/c. You'll need to do some text manipulation here.
jyoti vij
Greenhorn

Joined: Sep 14, 2007
Posts: 2
Thanks for your reply.
But i have one more query. How can i display a decimal point at fixed position in a textbox? Also how to check whether the user has entered data to the left or right of the decimal?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Displaying data from right to left in a textbox
 
Similar Threads
How to make secure admin console?
Remove highlight from a textbox
Convert decimal value to binary
Trying to use cache in my servlets application.
JFormattedTextField and MaskFormatter woes