This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes DOJO - Dynamically formatting phone number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "DOJO - Dynamically formatting phone number" Watch "DOJO - Dynamically formatting phone number" New topic
Author

DOJO - Dynamically formatting phone number

Meghana Reddy
Ranch Hand

Joined: Jan 29, 2002
Posts: 76
Hi

I've a form where user creates his profile.

When he enters the phone number as say 1234567890, I would like to dynamically format the phone number as (123)456-7890. We are using Struts DOJO framework. Is there a simple way to do this?

Thanks in advance.
Megh


Meghana Reddy
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I do not think they have it, I know they have validation for it.

It is not that hard to do with a simple replace regular expression to remove anything that is not a number and one to add the formatting.

Eric
Meghana Reddy
Ranch Hand

Joined: Jan 29, 2002
Posts: 76
Hi Eric

I'm new to DOJO/AJAX world.

Do you know of any tutorial that can quickly get me up to speed ?

We have a bunch of such validations/formatting to do.

Can this be done using dojo.string.substitute?

Thanks
Megh
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I have not used Dojo in a longt ime so I am not the best person to ask about it.

You might want to post over on the Dojo firums where they have people to really use it there: http://dojotoolkit.org/support

Eric
Arlo White
Greenhorn

Joined: Sep 11, 2013
Posts: 1
This reformats a ValidationTextBox value as ###-###-####.

The default filter method comes from _TextBoxMixin.js, which is where trim, uppercase, lowercase, and propercase is implemented.


 
wood burning stoves
 
subject: DOJO - Dynamically formatting phone number
 
Similar Threads
Anyone registered frm India?
* Winners: Practical Dojo Projects
* Winners: Learning Dojo
Help needed with DOJO and JSP
Email to contact