Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 18th, 2004, 11:02 AM
Smooth Criminal Smooth Criminal is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 Smooth Criminal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
custom Input Mask on a textbox

Hi

I have a form with multiple fields from Table Projects

In the textbox Project_Code, I inserted an Input Mask that goes like this

L00LLL00

L are for letters, 0 for numbers

example: 'A24DEX77'

the 3 middle letters, 'DEX' in this case, are exactly the same as an existing field called City_Code in the same form

So I'd like to create an Input Mask like L00 me.City_Code 00

Obviously that line isn't good

Is it possible to create that Input Mask?

Reply With Quote
  #2  
Old February 25th, 2005, 01:59 PM
cwolves cwolves is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 1 cwolves User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 sec
Reputation Power: 0
<input onkeypress="return Mask(this, '@##DEX##');">
<script>
function Mask(e, m){
if(event.keyCode>0){
e.focus();
var sel = document.selection;
var rng = sel.createRange();
rng.colapse;
if((sel.type == "Text" || sel.type == "None") && rng != null){
rng.text = String.fromCharCode(event.keyCode);
}
}
var ev = e.value;
if (event.keyCode>0){
e.value = '';
e.select();
}
var cIndx = -1;
var Out = '';
var cChar = '';
var mChar = ''
var nChar = '';
var Hold = '';
var rx;

for(var i=0; i<m.length; i++){
mChar = m.substr(i, 1)
if(mChar=='#' || mChar=='@'){
if(mChar=='#'){rx = /\d/;} else if(mChar=='@'){rx = /[a-zA-Z]/;}
cChar = ev.substr(++cIndx, 1);
if(m.substr(i+1,1)!='*')
cChar.toString();
while(cIndx < ev.length && !rx.test(cChar))
cChar = ev.substr(++cIndx, 1);
if (cIndx < ev.length && rx.test(cChar)){
Out += Hold + ev.substr(cIndx,1);
Hold = '';
if(m.substr(i+1,1)=='*' || m.substr(i+1,1)=='+'){
nChar = ev.substr(cIndx+1, 1);
while(cIndx < ev.length && rx.test(nChar)){
Out += nChar;
nChar = ev.substr(++cIndx+1, 1);
}
}
} else if (cIndx < ev.length && m.substr(i+1,1)=='*'){
--cIndx;
}
} else if(mChar!='*' && mChar!='+') {
if(ev.substr(cIndx+1, 1).toLowerCase()==mChar.toLowerCase()){
Out+=mChar;
cIndx++;
} else {
Hold += mChar;
}
}
if(cIndx >= ev.length){
e.value = Out;
return false;
}
}
e.value = Out;
return false;
}
</script>

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > custom Input Mask on a textbox


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT