/    Sign up×
Community /Pin to ProfileBookmark

problem in format

i want to do that if i enter the number(not more than 7 digits) in the following format..for ex…

bp0001–it will automatically changed to BP0001
br0001–it will automatically changed to BR0001
jv0001–it will automatically changed to JV0001

[code]
Voucher Number:<input name=”vouno” size=6 maxlength=”6″ onblur=”if(! (/^(BP|BR|JV)[0-9]{4}$/).test(this.value)) { alert(‘Format not valid’); this.value = ”;}”>
[/code]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@scragarMar 21.2005 — Voucher Number:

<input name="vouno" size=6 maxlength="6"

onblur="[color=red]this.value = this.value.replace(/^BP/i, "BP").replace(/^BR/i, "BR").replace(/^JV/i, "JV");[/color]if(!(/^(BP|BR|JV)[0-9]{4}$/).test(this.value)){alert('Format not valid');this.value = '';};" />
Copy linkTweet thisAlerts:
@abhit_kumarauthorMar 21.2005 — its coming syntax error..plz check it out...
Copy linkTweet thisAlerts:
@abhit_kumarauthorMar 22.2005 — its coming syntax error...plz look at this prob...
Copy linkTweet thisAlerts:
@Willy_DuittMar 22.2005 — <i>
</i>if(!(/^(BP|BR|JV)[0-9]{4}$/i).test(this.value)){
alert('Format not valid');this.value='';}
else this.value=this.value.toUpperCase();


.....Willy
×

Success!

Help @abhit_kumar 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...