-
1. Re: How to implement date mask with <rich:calendar in JSF ex:dd/MM/YYYY user want to enter only numeric numbers not "/"
bleathem Dec 12, 2013 4:23 PM (in response to tanakanti1)Have a look at the datePattern attribute of the calendar component.
http://docs.jboss.org/richfaces/latest_4_X/vdldoc/rich/calendar.html
-
2. Re: How to implement date mask with <rich:calendar in JSF ex:dd/MM/YYYY user want to enter only numeric numbers not "/"
tanakanti1 Dec 13, 2013 1:18 AM (in response to bleathem)Thank you for your answer.I refer that API i implemented that datepattern attribute.I want datemask on <rich:calander
-
3. Re: How to implement date mask with <rich:calendar in JSF ex:dd/MM/YYYY user want to enter only numeric numbers not "/"
liuliu Dec 13, 2013 3:07 AM (in response to tanakanti1)hi,
in my case, I taked a script from internet, and make it work for rich:calendar.
-
4. Re: How to implement date mask with <rich:calendar in JSF ex:dd/MM/YYYY user want to enter only numeric numbers not "/"
tanakanti1 Dec 13, 2013 6:47 AM (in response to liuliu)can u post that script and jsp page.
-
5. Re: Re: How to implement date mask with <rich:calendar in JSF ex:dd/MM/YYYY user want to enter only numeric numbers not "/"
liuliu Dec 16, 2013 5:42 AM (in response to tanakanti1)hi,
Here is some code about your question, you should modify it for your proper need.
keyDown = function(event) { if (event.keyCode == 13) { // enter input.blur(); } else if (!(event.keyCode == 9)) { //tab event.preventDefault(); switch (event.keyCode) { case 8: // Backspace break; case 36: // Home break; case 35: // End break; case 37: // Left break; case 38: // Up break; case 39: // Right break; case 40: // Down break; case 46: // Delete break; default: var chr = chrFromEvent(event); if ("0123456789".indexOf(chr) >= 0) { var p = getSelectionStart(this); var value = input.attr("value"); var output = ""; output += value.substring(0, p); output += chr; } break; } } };
-
6. Re: Re: How to implement date mask with <rich:calendar in JSF ex:dd/MM/YYYY user want to enter only numeric numbers not "/"
tanakanti1 Dec 17, 2013 6:30 AM (in response to liuliu)Hi,
I want mask for rich:calendar .I have to enter only 23/05/2013 "/" should append automatically to this string.
-
7. Re: Re: How to implement date mask with <rich:calendar in JSF ex:dd/MM/YYYY user want to enter only numeric numbers not "/"
liuliu Dec 17, 2013 12:06 PM (in response to tanakanti1)You can bind this event to input of calendar with jquery. and you should add and jump the "/" by moving the position of cursor.
-
8. Re: Re: How to implement date mask with <rich:calendar in JSF ex:dd/MM/YYYY user want to enter only numeric numbers not "/"
tanakanti1 Jan 15, 2014 9:47 AM (in response to liuliu)Hi,
please can you post code related to "jump the "/" by moving the position of cursor" i am beginner in jsf and jquery
-
9. Re: Re: Re: How to implement date mask with <rich:calendar in JSF ex:dd/MM/YYYY user want to enter only numeric numbers not "/"
liuliu Jan 16, 2014 3:25 AM (in response to tanakanti1)here is the code for selectPrevious
my mask is dd/mm/yyyyy, so the position of "/" is 2 and 5, so if your cursor's current position is 3 or 6, you need move left twice, the same for move right. Or you can juste test your mask to find where is the position of "/".
selectPrevious = function(obj, p) { if (!p) p = getSelectionStart(obj); if (p <= 0) { setSelection(obj,0, 1); } else { if (p != 3 && p != 6 && p != 11 && p != 14) { setSelection(obj,(p - 1), p); } else { selectPrevious(obj, p - 1); } } };