I'm using JSF 2.0, jquery 1.9 and javascript. I also have RichFaces (no PrimeFaces). I have a serial number input field. The serial number has this format
ABCD-1234-EFGH-5678
It can have any combination of numbers and digits. The only restrictions are: 1) Alphanumeric 2) 16 characters exactly
Now, for user's comfort, I need to dyamically add the '-' every 4 characters (except, of course, at the very end). I have no idea if this is possible with what I have. Any ideas?
Thanks!
-EDIT-
So, I'm using the jQuery.MaskedInput.js option. Here's my code
<script type="text/javascript">
// <![CDATA[
jQuery(function($){
$("#managerForm\\:computername1").mask("****-****-****-****",{placeholder:"Add Computer ID"});
$("#managerForm\\:computername2").mask("****-****-****-****",{placeholder:"Add Computer ID"});
$("#managerForm\\:computername3").mask("****-****-****-****",{placeholder:"Add Computer ID"});
});
// ]]>
</script>
But it's not working. The console says there's an uncaught error.
Object [object Object] has no method 'mask'
I'm importing this
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.maskedinput.js" type="text/javascript"></script>
Any ideas?