Hi Robert, thanks. I decided that it should work this way because it would be less confusing, IMO, for the user. I "disabled" the selection behavior. Did anybody complained about this behavior to you? Do you think its inappropriate? This particular behavior was one of the things that i didnt know what to do, i tried to make it similar to the ones i use on my bank's site, and it works the same way.
-- Fábio Miranda Costa Solucione Sistemas Engenheiro de interfaces On Thu, Apr 1, 2010 at 9:59 AM, Robert <[email protected]> wrote: > Hey, > I am using great script by Fabio Costa "Meio.Mask.Reverse". > I had some problems with selection functionality: after selecting > everything in the box and pressing "delete" or "backspace" or some > number value wasn't cleared, instead the number was added in the end > of the number (or delete last number). > In jquery version of the script it looks like everything is working > ok: > http://www.meiocodigo.com/projects/meiomask/#mm_signed > > I made a fast remedy for my client in keypress method: > //previous: > //elementValue = o.isRemoveKey ? elementValue.substring(0, > elementValue.length - 1) : this.getValue(elementValue + _char); > //my solution: > var selectionRange = this.element.getSelectedRange(); > var selStart = selectionRange.start; > var selEnd = selectionRange.end; > if (selStart < selEnd) { > elementValue = elementValue.substring(0, selStart) + > elementValue.substring(selEnd, elementValue.length); > } > if (o.isRemoveKey) { > if (selStart === selEnd) { > elementValue = elementValue.substring(0, > elementValue.length - 1); > } > } else { > elementValue = this.getValue(elementValue + _char); > } > > But maybe there is a better way to do this? Or am I missing something > and it shouldn't be done at all? > > > Happy Easter! > Robert > > > -- > To unsubscribe, reply using "remove me" as the subject. >
