- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
OK. I got this figured out. I had to adjust what was being backspaced over. (i.e., instead of just backspacing over the previous character, I set it to backspace over a selection.)
//test input
var r = new RegExp("[0-9]");
if (!r.test(xfa.event.newText)) xfa.event.change="";
//watch input for deleting charactersace
if (xfa.event.newText.length < xfa.event.prevText.length) {//if the number of characters gets smaller
if (xfa.event.newText.length%5 == 4 && xfa.event.newText.length !=0) {
//also want to be sure that the character removed was a dash/hyphen
xfa.event.selEnd = xfa.event.prevText.length;
xfa.event.selStart = xfa.event.newText.length -1;
//add in a dash if needed
else if (xfa.event.newText.length%5 == 4) xfa.event.change = xfa.event.change + "-";
Views
Replies
Total Likes