-
1. Re: rich:calendar with yyyy-MM gets cleared upon icon click
nbelaevski Jul 12, 2010 7:33 PM (in response to ariefz)1 of 1 people found this helpfulHi,
Calendar component validates input content and the validation is too strict for your case - date is undefined, so the whole selection is cleared. As a workaround, you can use pattern yyyy-MM-d, hide input via CSS and place text updated via JS by selection event instead of it.
-
2. Re: rich:calendar with yyyy-MM gets cleared upon icon click
ariefz Jul 13, 2010 1:14 AM (in response to nbelaevski)Thanks Nick.
I think we have thought that option before while working with some of the existing formatting text (masked-input) issue. We tried one of the jQuery plugin (i.e. http://digitalbush.com/projects/masked-input-plugin/). The following is our sample code on the javascript side:
{code}
<script type="text/javascript" src="js/jquery.maskedinput-1.2.2.js"></script>
<script type="text/javascript">jQuery(function($){$(".txt-mth-cal").mask("9999-99");});</script>{code}
I believe the way this plugin works is by changing the physical value inside the textbox with the formatted value (based on the pattern). So when we click on the icon, richfaces javascript will receive the already formatted value hence the problem still occured.
I do not have any other idea on the "hide input via CSS". Do you have any suggestion on that?
Many thanks.
-
3. Re: rich:calendar with yyyy-MM gets cleared upon icon click
nbelaevski Jul 13, 2010 5:06 AM (in response to ariefz)I meant that you can set calendar's pattern to yyyy-MM-d and hide its main input so that user won't see date number. Then you can provide your own input programmed via JS. It's easy to implement if you need read only input, but if not, I recommend to use another way - e.g. fix the problem in calendar code and rebuild it or use another component for months selection - e.g. a4j:repeat with links.