/    Sign up×
Community /Pin to ProfileBookmark

number format text input mask

i found this page [URL=”http://www.wiseblocks.com/”]http://www.wiseblocks.com/[/URL] it has alot of really nice ideas. The problem is to use their ideas requires about 500k worth of Javascript and using Yahoo’s library. i only want to use the date and number portions and have been trying to duplicate the phone number slot fond on this page listed as ICTextMask but i seem to be failing horribly.. i have tried numberous ways and just cant seem to duplicate it.. here is one of my failed attempts… if anyone can look at this and suggest some ideas?

[CODE]<script>

function fomit(mm) {
v=new Array(‘1’,'(‘,’_’,’_’,’_’,’)’,’_’,’_’,’_’,’-‘,’_’,’_’,’_’,’_’);
j=mm.value
for(i=0;i<j.length;i++){
k=j.charAt(i);
if (i!=0||i!=1||i!=5||i!=9){
if (k==”||k==’ ‘) {
k=’_’;
}
v[i]=k;
}
else { v[i]=v[i] }
}
mm.value=v.join(”)
}
</script>

<label for=’trial’>Number</lable></br>
<input name=’trial’ id=’trial’ value=’1(___)___-____’ size=’12’ maxlength=’14’ onkeyup=’fomit(this)’>[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@felgallSep 01.2007 — What about all the phone numbers that don't fit that format? Since most phone numbers don't fit that format you would do better to just accept whatever numbers are entered along with any + ( ) - x that might be included.
Copy linkTweet thisAlerts:
@pentaceauthorSep 01.2007 — this is for US mobile numbers only so this format will work fine
×

Success!

Help @pentace spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...